<?php


/**
 * Base class that represents a row from the 'users' table.
 *
 *
 *
 * @package    propel.generator.empeval.om
 */
abstract class EmpevalBaseUsers extends BaseObject implements Persistent
{
    /**
     * Peer class name
     */
    const PEER = 'EmpevalUsersPeer';

    /**
     * The Peer class.
     * Instance provides a convenient way of calling static methods on a class
     * that calling code may not be able to identify.
     * @var        EmpevalUsersPeer
     */
    protected static $peer;

    /**
     * The flag var to prevent infinit loop in deep copy
     * @var       boolean
     */
    protected $startCopy = false;

    /**
     * The value for the id field.
     * @var        int
     */
    protected $id;

    /**
     * The value for the ext_id field.
     * @var        string
     */
    protected $ext_id;

    /**
     * The value for the fname field.
     * @var        string
     */
    protected $fname;

    /**
     * The value for the lname field.
     * @var        string
     */
    protected $lname;

    /**
     * The value for the email field.
     * @var        string
     */
    protected $email;

    /**
     * The value for the optional_email field.
     * @var        string
     */
    protected $optional_email;

    /**
     * The value for the password field.
     * @var        string
     */
    protected $password;

    /**
     * The value for the company field.
     * @var        string
     */
    protected $company;

    /**
     * The value for the phone field.
     * @var        string
     */
    protected $phone;

    /**
     * The value for the mobile field.
     * @var        string
     */
    protected $mobile;

    /**
     * The value for the photo field.
     * @var        string
     */
    protected $photo;

    /**
     * The value for the ad_login_1 field.
     * @var        string
     */
    protected $ad_login_1;

    /**
     * The value for the ad_login_2 field.
     * @var        string
     */
    protected $ad_login_2;

    /**
     * The value for the ad_login_3 field.
     * @var        string
     */
    protected $ad_login_3;

    /**
     * The value for the deleted field.
     * @var        string
     */
    protected $deleted;

    /**
     * The value for the active field.
     * Note: this column has a database default value of: true
     * @var        boolean
     */
    protected $active;

    /**
     * The value for the last_modified field.
     * @var        string
     */
    protected $last_modified;

    /**
     * The value for the created field.
     * Note: this column has a database default value of: '2014-07-21 11:39:08'
     * @var        string
     */
    protected $created;

    /**
     * @var        PropelObjectCollection|EmpevalBonusGoalsForms[] Collection to store aggregation of EmpevalBonusGoalsForms objects.
     */
    protected $collBonusGoalsFormss;
    protected $collBonusGoalsFormssPartial;

    /**
     * @var        PropelObjectCollection|EmpevalSummary[] Collection to store aggregation of EmpevalSummary objects.
     */
    protected $collSummarys;
    protected $collSummarysPartial;

    /**
     * @var        PropelObjectCollection|EmpevalEmployeeEvaluations[] Collection to store aggregation of EmpevalEmployeeEvaluations objects.
     */
    protected $collEmployeeEvaluationss;
    protected $collEmployeeEvaluationssPartial;

    /**
     * @var        PropelObjectCollection|EmpevalUserRoles[] Collection to store aggregation of EmpevalUserRoles objects.
     */
    protected $collUserRolessRelatedByFormUserId;
    protected $collUserRolessRelatedByFormUserIdPartial;

    /**
     * @var        PropelObjectCollection|EmpevalUserRoles[] Collection to store aggregation of EmpevalUserRoles objects.
     */
    protected $collUserRolessRelatedByToUserId;
    protected $collUserRolessRelatedByToUserIdPartial;

    /**
     * @var        PropelObjectCollection|EmpevalCommittees[] Collection to store aggregation of EmpevalCommittees objects.
     */
    protected $collCommitteess;
    protected $collCommitteessPartial;

    /**
     * @var        PropelObjectCollection|EmpevalUserPositions[] Collection to store aggregation of EmpevalUserPositions objects.
     */
    protected $collUserPositionss;
    protected $collUserPositionssPartial;

    /**
     * @var        PropelObjectCollection|EmpevalAcceptance[] Collection to store aggregation of EmpevalAcceptance objects.
     */
    protected $collAcceptances;
    protected $collAcceptancesPartial;

    /**
     * @var        PropelObjectCollection|EmpevalViewBgfWithSuperiorPositionId[] Collection to store aggregation of EmpevalViewBgfWithSuperiorPositionId objects.
     */
    protected $collViewBgfWithSuperiorPositionIds;
    protected $collViewBgfWithSuperiorPositionIdsPartial;

    /**
     * @var        PropelObjectCollection|EmpevalNotificationUsers[] Collection to store aggregation of EmpevalNotificationUsers objects.
     */
    protected $collNotificationUserss;
    protected $collNotificationUserssPartial;

    /**
     * Flag to prevent endless save loop, if this object is referenced
     * by another object which falls in this transaction.
     * @var        boolean
     */
    protected $alreadyInSave = false;

    /**
     * Flag to prevent endless validation loop, if this object is referenced
     * by another object which falls in this transaction.
     * @var        boolean
     */
    protected $alreadyInValidation = false;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $bonusGoalsFormssScheduledForDeletion = null;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $summarysScheduledForDeletion = null;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $employeeEvaluationssScheduledForDeletion = null;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $userRolessRelatedByFormUserIdScheduledForDeletion = null;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $userRolessRelatedByToUserIdScheduledForDeletion = null;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $committeessScheduledForDeletion = null;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $userPositionssScheduledForDeletion = null;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $acceptancesScheduledForDeletion = null;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $viewBgfWithSuperiorPositionIdsScheduledForDeletion = null;

    /**
     * An array of objects scheduled for deletion.
     * @var		PropelObjectCollection
     */
    protected $notificationUserssScheduledForDeletion = null;

    /**
     * Applies default values to this object.
     * This method should be called from the object's constructor (or
     * equivalent initialization method).
     * @see        __construct()
     */
    public function applyDefaultValues()
    {
        $this->active = true;
        $this->created = '2014-07-21 11:39:08';
    }

    /**
     * Initializes internal state of EmpevalBaseUsers object.
     * @see        applyDefaults()
     */
    public function __construct()
    {
        parent::__construct();
        $this->applyDefaultValues();
    }

    /**
     * Get the [id] column value.
     *
     * @return int
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Get the [ext_id] column value.
     *
     * @return string
     */
    public function getExtId()
    {
        return $this->ext_id;
    }

    /**
     * Get the [fname] column value.
     *
     * @return string
     */
    public function getFname()
    {
        return $this->fname;
    }

    /**
     * Get the [lname] column value.
     *
     * @return string
     */
    public function getLname()
    {
        return $this->lname;
    }

    /**
     * Get the [email] column value.
     *
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Get the [optional_email] column value.
     *
     * @return string
     */
    public function getOptionalEmail()
    {
        return $this->optional_email;
    }

    /**
     * Get the [password] column value.
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Get the [company] column value.
     *
     * @return string
     */
    public function getCompany()
    {
        return $this->company;
    }

    /**
     * Get the [phone] column value.
     *
     * @return string
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * Get the [mobile] column value.
     *
     * @return string
     */
    public function getMobile()
    {
        return $this->mobile;
    }

    /**
     * Get the [photo] column value.
     *
     * @return string
     */
    public function getPhoto()
    {
        return $this->photo;
    }

    /**
     * Get the [ad_login_1] column value.
     *
     * @return string
     */
    public function getAdLogin1()
    {
        return $this->ad_login_1;
    }

    /**
     * Get the [ad_login_2] column value.
     *
     * @return string
     */
    public function getAdLogin2()
    {
        return $this->ad_login_2;
    }

    /**
     * Get the [ad_login_3] column value.
     *
     * @return string
     */
    public function getAdLogin3()
    {
        return $this->ad_login_3;
    }

    /**
     * Get the [optionally formatted] temporal [deleted] column value.
     *
     *
     * @param string $format The date/time format string (either date()-style or strftime()-style).
     *				 If format is null, then the raw DateTime object will be returned.
     * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null
     * @throws PropelException - if unable to parse/validate the date/time value.
     */
    public function getDeleted($format = 'Y-m-d H:i:s')
    {
        if ($this->deleted === null) {
            return null;
        }


        try {
            $dt = new DateTime($this->deleted);
        } catch (Exception $x) {
            throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->deleted, true), $x);
        }

        if ($format === null) {
            // Because propel.useDateTimeClass is true, we return a DateTime object.
            return $dt;
        } elseif (strpos($format, '%') !== false) {
            return strftime($format, $dt->format('U'));
        } else {
            return $dt->format($format);
        }
    }

    /**
     * Get the [active] column value.
     *
     * @return boolean
     */
    public function getActive()
    {
        return $this->active;
    }

    /**
     * Get the [optionally formatted] temporal [last_modified] column value.
     *
     *
     * @param string $format The date/time format string (either date()-style or strftime()-style).
     *				 If format is null, then the raw DateTime object will be returned.
     * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null
     * @throws PropelException - if unable to parse/validate the date/time value.
     */
    public function getLastModified($format = 'Y-m-d H:i:s')
    {
        if ($this->last_modified === null) {
            return null;
        }


        try {
            $dt = new DateTime($this->last_modified);
        } catch (Exception $x) {
            throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_modified, true), $x);
        }

        if ($format === null) {
            // Because propel.useDateTimeClass is true, we return a DateTime object.
            return $dt;
        } elseif (strpos($format, '%') !== false) {
            return strftime($format, $dt->format('U'));
        } else {
            return $dt->format($format);
        }
    }

    /**
     * Get the [optionally formatted] temporal [created] column value.
     *
     *
     * @param string $format The date/time format string (either date()-style or strftime()-style).
     *				 If format is null, then the raw DateTime object will be returned.
     * @return mixed Formatted date/time value as string or DateTime object (if format is null), null if column is null
     * @throws PropelException - if unable to parse/validate the date/time value.
     */
    public function getCreated($format = 'Y-m-d H:i:s')
    {
        if ($this->created === null) {
            return null;
        }


        try {
            $dt = new DateTime($this->created);
        } catch (Exception $x) {
            throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->created, true), $x);
        }

        if ($format === null) {
            // Because propel.useDateTimeClass is true, we return a DateTime object.
            return $dt;
        } elseif (strpos($format, '%') !== false) {
            return strftime($format, $dt->format('U'));
        } else {
            return $dt->format($format);
        }
    }

    /**
     * Set the value of [id] column.
     *
     * @param int $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setId($v)
    {
        if ($v !== null) {
            $v = (int) $v;
        }

        if ($this->id !== $v) {
            $this->id = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::ID;
        }


        return $this;
    } // setId()

    /**
     * Set the value of [ext_id] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setExtId($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->ext_id !== $v) {
            $this->ext_id = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::EXT_ID;
        }


        return $this;
    } // setExtId()

    /**
     * Set the value of [fname] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setFname($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->fname !== $v) {
            $this->fname = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::FNAME;
        }


        return $this;
    } // setFname()

    /**
     * Set the value of [lname] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setLname($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->lname !== $v) {
            $this->lname = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::LNAME;
        }


        return $this;
    } // setLname()

    /**
     * Set the value of [email] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setEmail($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->email !== $v) {
            $this->email = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::EMAIL;
        }


        return $this;
    } // setEmail()

    /**
     * Set the value of [optional_email] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setOptionalEmail($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->optional_email !== $v) {
            $this->optional_email = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::OPTIONAL_EMAIL;
        }


        return $this;
    } // setOptionalEmail()

    /**
     * Set the value of [password] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setPassword($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->password !== $v) {
            $this->password = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::PASSWORD;
        }


        return $this;
    } // setPassword()

    /**
     * Set the value of [company] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setCompany($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->company !== $v) {
            $this->company = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::COMPANY;
        }


        return $this;
    } // setCompany()

    /**
     * Set the value of [phone] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setPhone($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->phone !== $v) {
            $this->phone = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::PHONE;
        }


        return $this;
    } // setPhone()

    /**
     * Set the value of [mobile] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setMobile($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->mobile !== $v) {
            $this->mobile = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::MOBILE;
        }


        return $this;
    } // setMobile()

    /**
     * Set the value of [photo] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setPhoto($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->photo !== $v) {
            $this->photo = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::PHOTO;
        }


        return $this;
    } // setPhoto()

    /**
     * Set the value of [ad_login_1] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setAdLogin1($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->ad_login_1 !== $v) {
            $this->ad_login_1 = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::AD_LOGIN_1;
        }


        return $this;
    } // setAdLogin1()

    /**
     * Set the value of [ad_login_2] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setAdLogin2($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->ad_login_2 !== $v) {
            $this->ad_login_2 = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::AD_LOGIN_2;
        }


        return $this;
    } // setAdLogin2()

    /**
     * Set the value of [ad_login_3] column.
     *
     * @param string $v new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setAdLogin3($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->ad_login_3 !== $v) {
            $this->ad_login_3 = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::AD_LOGIN_3;
        }


        return $this;
    } // setAdLogin3()

    /**
     * Sets the value of [deleted] column to a normalized version of the date/time value specified.
     *
     * @param mixed $v string, integer (timestamp), or DateTime value.
     *               Empty strings are treated as null.
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setDeleted($v)
    {
        $dt = PropelDateTime::newInstance($v, null, 'DateTime');
        if ($this->deleted !== null || $dt !== null) {
            $currentDateAsString = ($this->deleted !== null && $tmpDt = new DateTime($this->deleted)) ? $tmpDt->format('Y-m-d H:i:s') : null;
            $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
            if ($currentDateAsString !== $newDateAsString) {
                $this->deleted = $newDateAsString;
                $this->modifiedColumns[] = EmpevalUsersPeer::DELETED;
            }
        } // if either are not null


        return $this;
    } // setDeleted()

    /**
     * Sets the value of the [active] column.
     * Non-boolean arguments are converted using the following rules:
     *   * 1, '1', 'true',  'on',  and 'yes' are converted to boolean true
     *   * 0, '0', 'false', 'off', and 'no'  are converted to boolean false
     * Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
     *
     * @param boolean|integer|string $v The new value
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setActive($v)
    {
        if ($v !== null) {
            if (is_string($v)) {
                $v = in_array(strtolower($v), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
            } else {
                $v = (boolean) $v;
            }
        }

        if ($this->active !== $v) {
            $this->active = $v;
            $this->modifiedColumns[] = EmpevalUsersPeer::ACTIVE;
        }


        return $this;
    } // setActive()

    /**
     * Sets the value of [last_modified] column to a normalized version of the date/time value specified.
     *
     * @param mixed $v string, integer (timestamp), or DateTime value.
     *               Empty strings are treated as null.
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setLastModified($v)
    {
        $dt = PropelDateTime::newInstance($v, null, 'DateTime');
        if ($this->last_modified !== null || $dt !== null) {
            $currentDateAsString = ($this->last_modified !== null && $tmpDt = new DateTime($this->last_modified)) ? $tmpDt->format('Y-m-d H:i:s') : null;
            $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
            if ($currentDateAsString !== $newDateAsString) {
                $this->last_modified = $newDateAsString;
                $this->modifiedColumns[] = EmpevalUsersPeer::LAST_MODIFIED;
            }
        } // if either are not null


        return $this;
    } // setLastModified()

    /**
     * Sets the value of [created] column to a normalized version of the date/time value specified.
     *
     * @param mixed $v string, integer (timestamp), or DateTime value.
     *               Empty strings are treated as null.
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function setCreated($v)
    {
        $dt = PropelDateTime::newInstance($v, null, 'DateTime');
        if ($this->created !== null || $dt !== null) {
            $currentDateAsString = ($this->created !== null && $tmpDt = new DateTime($this->created)) ? $tmpDt->format('Y-m-d H:i:s') : null;
            $newDateAsString = $dt ? $dt->format('Y-m-d H:i:s') : null;
            if ( ($currentDateAsString !== $newDateAsString) // normalized values don't match
                || ($dt->format('Y-m-d H:i:s') === '2014-07-21 11:39:08') // or the entered value matches the default
                 ) {
                $this->created = $newDateAsString;
                $this->modifiedColumns[] = EmpevalUsersPeer::CREATED;
            }
        } // if either are not null


        return $this;
    } // setCreated()

    /**
     * Indicates whether the columns in this object are only set to default values.
     *
     * This method can be used in conjunction with isModified() to indicate whether an object is both
     * modified _and_ has some values set which are non-default.
     *
     * @return boolean Whether the columns in this object are only been set with default values.
     */
    public function hasOnlyDefaultValues()
    {
            if ($this->active !== true) {
                return false;
            }

            if ($this->created !== '2014-07-21 11:39:08') {
                return false;
            }

        // otherwise, everything was equal, so return true
        return true;
    } // hasOnlyDefaultValues()

    /**
     * Hydrates (populates) the object variables with values from the database resultset.
     *
     * An offset (0-based "start column") is specified so that objects can be hydrated
     * with a subset of the columns in the resultset rows.  This is needed, for example,
     * for results of JOIN queries where the resultset row includes columns from two or
     * more tables.
     *
     * @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
     * @param int $startcol 0-based offset column which indicates which restultset column to start with.
     * @param boolean $rehydrate Whether this object is being re-hydrated from the database.
     * @return int             next starting column
     * @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
     */
    public function hydrate($row, $startcol = 0, $rehydrate = false)
    {
        try {

            $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
            $this->ext_id = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
            $this->fname = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
            $this->lname = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
            $this->email = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
            $this->optional_email = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null;
            $this->password = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null;
            $this->company = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null;
            $this->phone = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null;
            $this->mobile = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null;
            $this->photo = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null;
            $this->ad_login_1 = ($row[$startcol + 11] !== null) ? (string) $row[$startcol + 11] : null;
            $this->ad_login_2 = ($row[$startcol + 12] !== null) ? (string) $row[$startcol + 12] : null;
            $this->ad_login_3 = ($row[$startcol + 13] !== null) ? (string) $row[$startcol + 13] : null;
            $this->deleted = ($row[$startcol + 14] !== null) ? (string) $row[$startcol + 14] : null;
            $this->active = ($row[$startcol + 15] !== null) ? (boolean) $row[$startcol + 15] : null;
            $this->last_modified = ($row[$startcol + 16] !== null) ? (string) $row[$startcol + 16] : null;
            $this->created = ($row[$startcol + 17] !== null) ? (string) $row[$startcol + 17] : null;
            $this->resetModified();

            $this->setNew(false);

            if ($rehydrate) {
                $this->ensureConsistency();
            }

            return $startcol + 18; // 18 = EmpevalUsersPeer::NUM_HYDRATE_COLUMNS.

        } catch (Exception $e) {
            throw new PropelException("Error populating EmpevalUsers object", $e);
        }
    }

    /**
     * Checks and repairs the internal consistency of the object.
     *
     * This method is executed after an already-instantiated object is re-hydrated
     * from the database.  It exists to check any foreign keys to make sure that
     * the objects related to the current object are correct based on foreign key.
     *
     * You can override this method in the stub class, but you should always invoke
     * the base method from the overridden method (i.e. parent::ensureConsistency()),
     * in case your model changes.
     *
     * @throws PropelException
     */
    public function ensureConsistency()
    {

    } // ensureConsistency

    /**
     * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
     *
     * This will only work if the object has been saved and has a valid primary key set.
     *
     * @param boolean $deep (optional) Whether to also de-associated any related objects.
     * @param PropelPDO $con (optional) The PropelPDO connection to use.
     * @return void
     * @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
     */
    public function reload($deep = false, PropelPDO $con = null)
    {
        if ($this->isDeleted()) {
            throw new PropelException("Cannot reload a deleted object.");
        }

        if ($this->isNew()) {
            throw new PropelException("Cannot reload an unsaved object.");
        }

        if ($con === null) {
            $con = Propel::getConnection(EmpevalUsersPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }

        // We don't need to alter the object instance pool; we're just modifying this instance
        // already in the pool.

        $stmt = EmpevalUsersPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
        $row = $stmt->fetch(PDO::FETCH_NUM);
        $stmt->closeCursor();
        if (!$row) {
            throw new PropelException('Cannot find matching row in the database to reload object values.');
        }
        $this->hydrate($row, 0, true); // rehydrate

        if ($deep) {  // also de-associate any related objects?

            $this->collBonusGoalsFormss = null;

            $this->collSummarys = null;

            $this->collEmployeeEvaluationss = null;

            $this->collUserRolessRelatedByFormUserId = null;

            $this->collUserRolessRelatedByToUserId = null;

            $this->collCommitteess = null;

            $this->collUserPositionss = null;

            $this->collAcceptances = null;

            $this->collViewBgfWithSuperiorPositionIds = null;

            $this->collNotificationUserss = null;

        } // if (deep)
    }

    /**
     * Removes this object from datastore and sets delete attribute.
     *
     * @param PropelPDO $con
     * @return void
     * @throws PropelException
     * @throws Exception
     * @see        BaseObject::setDeleted()
     * @see        BaseObject::isDeleted()
     */
    public function delete(PropelPDO $con = null)
    {
        if ($this->isDeleted()) {
            throw new PropelException("This object has already been deleted.");
        }

        if ($con === null) {
            $con = Propel::getConnection(EmpevalUsersPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
        }

        $con->beginTransaction();
        try {
            $deleteQuery = EmpevalUsersQuery::create()
                ->filterByPrimaryKey($this->getPrimaryKey());
            $ret = $this->preDelete($con);
            if ($ret) {
                $deleteQuery->delete($con);
                $this->postDelete($con);
                $con->commit();
                $this->setDeleted(true);
            } else {
                $con->commit();
            }
        } catch (Exception $e) {
            $con->rollBack();
            throw $e;
        }
    }

    /**
     * Persists this object to the database.
     *
     * If the object is new, it inserts it; otherwise an update is performed.
     * All modified related objects will also be persisted in the doSave()
     * method.  This method wraps all precipitate database operations in a
     * single transaction.
     *
     * @param PropelPDO $con
     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
     * @throws PropelException
     * @throws Exception
     * @see        doSave()
     */
    public function save(PropelPDO $con = null)
    {
        if ($this->isDeleted()) {
            throw new PropelException("You cannot save an object that has been deleted.");
        }

        if ($con === null) {
            $con = Propel::getConnection(EmpevalUsersPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
        }

        $con->beginTransaction();
        $isInsert = $this->isNew();
        try {
            $ret = $this->preSave($con);
            if ($isInsert) {
                $ret = $ret && $this->preInsert($con);
            } else {
                $ret = $ret && $this->preUpdate($con);
            }
            if ($ret) {
                $affectedRows = $this->doSave($con);
                if ($isInsert) {
                    $this->postInsert($con);
                } else {
                    $this->postUpdate($con);
                }
                $this->postSave($con);
                EmpevalUsersPeer::addInstanceToPool($this);
            } else {
                $affectedRows = 0;
            }
            $con->commit();

            return $affectedRows;
        } catch (Exception $e) {
            $con->rollBack();
            throw $e;
        }
    }

    /**
     * Performs the work of inserting or updating the row in the database.
     *
     * If the object is new, it inserts it; otherwise an update is performed.
     * All related objects are also updated in this method.
     *
     * @param PropelPDO $con
     * @return int             The number of rows affected by this insert/update and any referring fk objects' save() operations.
     * @throws PropelException
     * @see        save()
     */
    protected function doSave(PropelPDO $con)
    {
        $affectedRows = 0; // initialize var to track total num of affected rows
        if (!$this->alreadyInSave) {
            $this->alreadyInSave = true;

            if ($this->isNew() || $this->isModified()) {
                // persist changes
                if ($this->isNew()) {
                    $this->doInsert($con);
                } else {
                    $this->doUpdate($con);
                }
                $affectedRows += 1;
                $this->resetModified();
            }

            if ($this->bonusGoalsFormssScheduledForDeletion !== null) {
                if (!$this->bonusGoalsFormssScheduledForDeletion->isEmpty()) {
                    foreach ($this->bonusGoalsFormssScheduledForDeletion as $bonusGoalsForms) {
                        // need to save related object because we set the relation to null
                        $bonusGoalsForms->save($con);
                    }
                    $this->bonusGoalsFormssScheduledForDeletion = null;
                }
            }

            if ($this->collBonusGoalsFormss !== null) {
                foreach ($this->collBonusGoalsFormss as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            if ($this->summarysScheduledForDeletion !== null) {
                if (!$this->summarysScheduledForDeletion->isEmpty()) {
                    EmpevalSummaryQuery::create()
                        ->filterByPrimaryKeys($this->summarysScheduledForDeletion->getPrimaryKeys(false))
                        ->delete($con);
                    $this->summarysScheduledForDeletion = null;
                }
            }

            if ($this->collSummarys !== null) {
                foreach ($this->collSummarys as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            if ($this->employeeEvaluationssScheduledForDeletion !== null) {
                if (!$this->employeeEvaluationssScheduledForDeletion->isEmpty()) {
                    EmpevalEmployeeEvaluationsQuery::create()
                        ->filterByPrimaryKeys($this->employeeEvaluationssScheduledForDeletion->getPrimaryKeys(false))
                        ->delete($con);
                    $this->employeeEvaluationssScheduledForDeletion = null;
                }
            }

            if ($this->collEmployeeEvaluationss !== null) {
                foreach ($this->collEmployeeEvaluationss as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            if ($this->userRolessRelatedByFormUserIdScheduledForDeletion !== null) {
                if (!$this->userRolessRelatedByFormUserIdScheduledForDeletion->isEmpty()) {
                    foreach ($this->userRolessRelatedByFormUserIdScheduledForDeletion as $userRolesRelatedByFormUserId) {
                        // need to save related object because we set the relation to null
                        $userRolesRelatedByFormUserId->save($con);
                    }
                    $this->userRolessRelatedByFormUserIdScheduledForDeletion = null;
                }
            }

            if ($this->collUserRolessRelatedByFormUserId !== null) {
                foreach ($this->collUserRolessRelatedByFormUserId as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            if ($this->userRolessRelatedByToUserIdScheduledForDeletion !== null) {
                if (!$this->userRolessRelatedByToUserIdScheduledForDeletion->isEmpty()) {
                    EmpevalUserRolesQuery::create()
                        ->filterByPrimaryKeys($this->userRolessRelatedByToUserIdScheduledForDeletion->getPrimaryKeys(false))
                        ->delete($con);
                    $this->userRolessRelatedByToUserIdScheduledForDeletion = null;
                }
            }

            if ($this->collUserRolessRelatedByToUserId !== null) {
                foreach ($this->collUserRolessRelatedByToUserId as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            if ($this->committeessScheduledForDeletion !== null) {
                if (!$this->committeessScheduledForDeletion->isEmpty()) {
                    EmpevalCommitteesQuery::create()
                        ->filterByPrimaryKeys($this->committeessScheduledForDeletion->getPrimaryKeys(false))
                        ->delete($con);
                    $this->committeessScheduledForDeletion = null;
                }
            }

            if ($this->collCommitteess !== null) {
                foreach ($this->collCommitteess as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            if ($this->userPositionssScheduledForDeletion !== null) {
                if (!$this->userPositionssScheduledForDeletion->isEmpty()) {
                    EmpevalUserPositionsQuery::create()
                        ->filterByPrimaryKeys($this->userPositionssScheduledForDeletion->getPrimaryKeys(false))
                        ->delete($con);
                    $this->userPositionssScheduledForDeletion = null;
                }
            }

            if ($this->collUserPositionss !== null) {
                foreach ($this->collUserPositionss as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            if ($this->acceptancesScheduledForDeletion !== null) {
                if (!$this->acceptancesScheduledForDeletion->isEmpty()) {
                    EmpevalAcceptanceQuery::create()
                        ->filterByPrimaryKeys($this->acceptancesScheduledForDeletion->getPrimaryKeys(false))
                        ->delete($con);
                    $this->acceptancesScheduledForDeletion = null;
                }
            }

            if ($this->collAcceptances !== null) {
                foreach ($this->collAcceptances as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            if ($this->viewBgfWithSuperiorPositionIdsScheduledForDeletion !== null) {
                if (!$this->viewBgfWithSuperiorPositionIdsScheduledForDeletion->isEmpty()) {
                    foreach ($this->viewBgfWithSuperiorPositionIdsScheduledForDeletion as $viewBgfWithSuperiorPositionId) {
                        // need to save related object because we set the relation to null
                        $viewBgfWithSuperiorPositionId->save($con);
                    }
                    $this->viewBgfWithSuperiorPositionIdsScheduledForDeletion = null;
                }
            }

            if ($this->collViewBgfWithSuperiorPositionIds !== null) {
                foreach ($this->collViewBgfWithSuperiorPositionIds as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            if ($this->notificationUserssScheduledForDeletion !== null) {
                if (!$this->notificationUserssScheduledForDeletion->isEmpty()) {
                    EmpevalNotificationUsersQuery::create()
                        ->filterByPrimaryKeys($this->notificationUserssScheduledForDeletion->getPrimaryKeys(false))
                        ->delete($con);
                    $this->notificationUserssScheduledForDeletion = null;
                }
            }

            if ($this->collNotificationUserss !== null) {
                foreach ($this->collNotificationUserss as $referrerFK) {
                    if (!$referrerFK->isDeleted()) {
                        $affectedRows += $referrerFK->save($con);
                    }
                }
            }

            $this->alreadyInSave = false;

        }

        return $affectedRows;
    } // doSave()

    /**
     * Insert the row in the database.
     *
     * @param PropelPDO $con
     *
     * @throws PropelException
     * @see        doSave()
     */
    protected function doInsert(PropelPDO $con)
    {
        $this->modifiedColumns[] = EmpevalUsersPeer::ID;
        $criteria = $this->buildCriteria();
        if ($criteria->keyContainsValue(EmpevalUsersPeer::ID) ) {
            throw new PropelException('Cannot insert a value for auto-increment primary key (' . EmpevalUsersPeer::ID . ')');
        }
        // remove pkey col since this table uses auto-increment and passing a null value for it is not valid
        $criteria->remove(EmpevalUsersPeer::ID);
        $pk = BasePeer::doInsert($criteria, $con);
        $this->setId($pk);  //[IMV] update autoincrement primary key
        $this->setNew(false);
    }

    /**
     * Update the row in the database.
     *
     * @param PropelPDO $con
     *
     * @see        doSave()
     */
    protected function doUpdate(PropelPDO $con)
    {
        $selectCriteria = $this->buildPkeyCriteria();
        $valuesCriteria = $this->buildCriteria();
        BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
    }

    /**
     * Array of ValidationFailed objects.
     * @var        array ValidationFailed[]
     */
    protected $validationFailures = array();

    /**
     * Gets any ValidationFailed objects that resulted from last call to validate().
     *
     *
     * @return array ValidationFailed[]
     * @see        validate()
     */
    public function getValidationFailures()
    {
        return $this->validationFailures;
    }

    /**
     * Validates the objects modified field values and all objects related to this table.
     *
     * If $columns is either a column name or an array of column names
     * only those columns are validated.
     *
     * @param mixed $columns Column name or an array of column names.
     * @return boolean Whether all columns pass validation.
     * @see        doValidate()
     * @see        getValidationFailures()
     */
    public function validate($columns = null)
    {
        $res = $this->doValidate($columns);
        if ($res === true) {
            $this->validationFailures = array();

            return true;
        } else {
            $this->validationFailures = $res;

            return false;
        }
    }

    /**
     * This function performs the validation work for complex object models.
     *
     * In addition to checking the current object, all related objects will
     * also be validated.  If all pass then <code>true</code> is returned; otherwise
     * an aggreagated array of ValidationFailed objects will be returned.
     *
     * @param array $columns Array of column names to validate.
     * @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
     */
    protected function doValidate($columns = null)
    {
        if (!$this->alreadyInValidation) {
            $this->alreadyInValidation = true;
            $retval = null;

            $failureMap = array();


            if (($retval = EmpevalUsersPeer::doValidate($this, $columns)) !== true) {
                $failureMap = array_merge($failureMap, $retval);
            }


                if ($this->collBonusGoalsFormss !== null) {
                    foreach ($this->collBonusGoalsFormss as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }

                if ($this->collSummarys !== null) {
                    foreach ($this->collSummarys as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }

                if ($this->collEmployeeEvaluationss !== null) {
                    foreach ($this->collEmployeeEvaluationss as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }

                if ($this->collUserRolessRelatedByFormUserId !== null) {
                    foreach ($this->collUserRolessRelatedByFormUserId as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }

                if ($this->collUserRolessRelatedByToUserId !== null) {
                    foreach ($this->collUserRolessRelatedByToUserId as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }

                if ($this->collCommitteess !== null) {
                    foreach ($this->collCommitteess as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }

                if ($this->collUserPositionss !== null) {
                    foreach ($this->collUserPositionss as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }

                if ($this->collAcceptances !== null) {
                    foreach ($this->collAcceptances as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }

                if ($this->collViewBgfWithSuperiorPositionIds !== null) {
                    foreach ($this->collViewBgfWithSuperiorPositionIds as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }

                if ($this->collNotificationUserss !== null) {
                    foreach ($this->collNotificationUserss as $referrerFK) {
                        if (!$referrerFK->validate($columns)) {
                            $failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
                        }
                    }
                }


            $this->alreadyInValidation = false;
        }

        return (!empty($failureMap) ? $failureMap : true);
    }

    /**
     * Retrieves a field from the object by name passed in as a string.
     *
     * @param string $name name
     * @param string $type The type of fieldname the $name is of:
     *               one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     *               BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
     *               Defaults to BasePeer::TYPE_PHPNAME
     * @return mixed Value of field.
     */
    public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
    {
        $pos = EmpevalUsersPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
        $field = $this->getByPosition($pos);

        return $field;
    }

    /**
     * Retrieves a field from the object by Position as specified in the xml schema.
     * Zero-based.
     *
     * @param int $pos position in xml schema
     * @return mixed Value of field at $pos
     */
    public function getByPosition($pos)
    {
        switch ($pos) {
            case 0:
                return $this->getId();
                break;
            case 1:
                return $this->getExtId();
                break;
            case 2:
                return $this->getFname();
                break;
            case 3:
                return $this->getLname();
                break;
            case 4:
                return $this->getEmail();
                break;
            case 5:
                return $this->getOptionalEmail();
                break;
            case 6:
                return $this->getPassword();
                break;
            case 7:
                return $this->getCompany();
                break;
            case 8:
                return $this->getPhone();
                break;
            case 9:
                return $this->getMobile();
                break;
            case 10:
                return $this->getPhoto();
                break;
            case 11:
                return $this->getAdLogin1();
                break;
            case 12:
                return $this->getAdLogin2();
                break;
            case 13:
                return $this->getAdLogin3();
                break;
            case 14:
                return $this->getDeleted();
                break;
            case 15:
                return $this->getActive();
                break;
            case 16:
                return $this->getLastModified();
                break;
            case 17:
                return $this->getCreated();
                break;
            default:
                return null;
                break;
        } // switch()
    }

    /**
     * Exports the object as an array.
     *
     * You can specify the key type of the array by passing one of the class
     * type constants.
     *
     * @param     string  $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
     *                    BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
     *                    Defaults to BasePeer::TYPE_PHPNAME.
     * @param     boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
     * @param     array $alreadyDumpedObjects List of objects to skip to avoid recursion
     * @param     boolean $includeForeignObjects (optional) Whether to include hydrated related objects. Default to FALSE.
     *
     * @return array an associative array containing the field names (as keys) and field values
     */
    public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array(), $includeForeignObjects = false)
    {
        if (isset($alreadyDumpedObjects['EmpevalUsers'][$this->getPrimaryKey()])) {
            return '*RECURSION*';
        }
        $alreadyDumpedObjects['EmpevalUsers'][$this->getPrimaryKey()] = true;
        $keys = EmpevalUsersPeer::getFieldNames($keyType);
        $result = array(
            $keys[0] => $this->getId(),
            $keys[1] => $this->getExtId(),
            $keys[2] => $this->getFname(),
            $keys[3] => $this->getLname(),
            $keys[4] => $this->getEmail(),
            $keys[5] => $this->getOptionalEmail(),
            $keys[6] => $this->getPassword(),
            $keys[7] => $this->getCompany(),
            $keys[8] => $this->getPhone(),
            $keys[9] => $this->getMobile(),
            $keys[10] => $this->getPhoto(),
            $keys[11] => $this->getAdLogin1(),
            $keys[12] => $this->getAdLogin2(),
            $keys[13] => $this->getAdLogin3(),
            $keys[14] => $this->getDeleted(),
            $keys[15] => $this->getActive(),
            $keys[16] => $this->getLastModified(),
            $keys[17] => $this->getCreated(),
        );
        if ($includeForeignObjects) {
            if (null !== $this->collBonusGoalsFormss) {
                $result['BonusGoalsFormss'] = $this->collBonusGoalsFormss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
            if (null !== $this->collSummarys) {
                $result['Summarys'] = $this->collSummarys->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
            if (null !== $this->collEmployeeEvaluationss) {
                $result['EmployeeEvaluationss'] = $this->collEmployeeEvaluationss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
            if (null !== $this->collUserRolessRelatedByFormUserId) {
                $result['UserRolessRelatedByFormUserId'] = $this->collUserRolessRelatedByFormUserId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
            if (null !== $this->collUserRolessRelatedByToUserId) {
                $result['UserRolessRelatedByToUserId'] = $this->collUserRolessRelatedByToUserId->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
            if (null !== $this->collCommitteess) {
                $result['Committeess'] = $this->collCommitteess->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
            if (null !== $this->collUserPositionss) {
                $result['UserPositionss'] = $this->collUserPositionss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
            if (null !== $this->collAcceptances) {
                $result['Acceptances'] = $this->collAcceptances->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
            if (null !== $this->collViewBgfWithSuperiorPositionIds) {
                $result['ViewBgfWithSuperiorPositionIds'] = $this->collViewBgfWithSuperiorPositionIds->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
            if (null !== $this->collNotificationUserss) {
                $result['NotificationUserss'] = $this->collNotificationUserss->toArray(null, true, $keyType, $includeLazyLoadColumns, $alreadyDumpedObjects);
            }
        }

        return $result;
    }

    /**
     * Sets a field from the object by name passed in as a string.
     *
     * @param string $name peer name
     * @param mixed $value field value
     * @param string $type The type of fieldname the $name is of:
     *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
     *                     Defaults to BasePeer::TYPE_PHPNAME
     * @return void
     */
    public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
    {
        $pos = EmpevalUsersPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);

        $this->setByPosition($pos, $value);
    }

    /**
     * Sets a field from the object by Position as specified in the xml schema.
     * Zero-based.
     *
     * @param int $pos position in xml schema
     * @param mixed $value field value
     * @return void
     */
    public function setByPosition($pos, $value)
    {
        switch ($pos) {
            case 0:
                $this->setId($value);
                break;
            case 1:
                $this->setExtId($value);
                break;
            case 2:
                $this->setFname($value);
                break;
            case 3:
                $this->setLname($value);
                break;
            case 4:
                $this->setEmail($value);
                break;
            case 5:
                $this->setOptionalEmail($value);
                break;
            case 6:
                $this->setPassword($value);
                break;
            case 7:
                $this->setCompany($value);
                break;
            case 8:
                $this->setPhone($value);
                break;
            case 9:
                $this->setMobile($value);
                break;
            case 10:
                $this->setPhoto($value);
                break;
            case 11:
                $this->setAdLogin1($value);
                break;
            case 12:
                $this->setAdLogin2($value);
                break;
            case 13:
                $this->setAdLogin3($value);
                break;
            case 14:
                $this->setDeleted($value);
                break;
            case 15:
                $this->setActive($value);
                break;
            case 16:
                $this->setLastModified($value);
                break;
            case 17:
                $this->setCreated($value);
                break;
        } // switch()
    }

    /**
     * Populates the object using an array.
     *
     * This is particularly useful when populating an object from one of the
     * request arrays (e.g. $_POST).  This method goes through the column
     * names, checking to see whether a matching key exists in populated
     * array. If so the setByName() method is called for that column.
     *
     * You can specify the key type of the array by additionally passing one
     * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
     * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
     * The default key type is the column's BasePeer::TYPE_PHPNAME
     *
     * @param array  $arr     An array to populate the object from.
     * @param string $keyType The type of keys the array uses.
     * @return void
     */
    public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
    {
        $keys = EmpevalUsersPeer::getFieldNames($keyType);

        if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
        if (array_key_exists($keys[1], $arr)) $this->setExtId($arr[$keys[1]]);
        if (array_key_exists($keys[2], $arr)) $this->setFname($arr[$keys[2]]);
        if (array_key_exists($keys[3], $arr)) $this->setLname($arr[$keys[3]]);
        if (array_key_exists($keys[4], $arr)) $this->setEmail($arr[$keys[4]]);
        if (array_key_exists($keys[5], $arr)) $this->setOptionalEmail($arr[$keys[5]]);
        if (array_key_exists($keys[6], $arr)) $this->setPassword($arr[$keys[6]]);
        if (array_key_exists($keys[7], $arr)) $this->setCompany($arr[$keys[7]]);
        if (array_key_exists($keys[8], $arr)) $this->setPhone($arr[$keys[8]]);
        if (array_key_exists($keys[9], $arr)) $this->setMobile($arr[$keys[9]]);
        if (array_key_exists($keys[10], $arr)) $this->setPhoto($arr[$keys[10]]);
        if (array_key_exists($keys[11], $arr)) $this->setAdLogin1($arr[$keys[11]]);
        if (array_key_exists($keys[12], $arr)) $this->setAdLogin2($arr[$keys[12]]);
        if (array_key_exists($keys[13], $arr)) $this->setAdLogin3($arr[$keys[13]]);
        if (array_key_exists($keys[14], $arr)) $this->setDeleted($arr[$keys[14]]);
        if (array_key_exists($keys[15], $arr)) $this->setActive($arr[$keys[15]]);
        if (array_key_exists($keys[16], $arr)) $this->setLastModified($arr[$keys[16]]);
        if (array_key_exists($keys[17], $arr)) $this->setCreated($arr[$keys[17]]);
    }

    /**
     * Build a Criteria object containing the values of all modified columns in this object.
     *
     * @return Criteria The Criteria object containing all modified values.
     */
    public function buildCriteria()
    {
        $criteria = new Criteria(EmpevalUsersPeer::DATABASE_NAME);

        if ($this->isColumnModified(EmpevalUsersPeer::ID)) $criteria->add(EmpevalUsersPeer::ID, $this->id);
        if ($this->isColumnModified(EmpevalUsersPeer::EXT_ID)) $criteria->add(EmpevalUsersPeer::EXT_ID, $this->ext_id);
        if ($this->isColumnModified(EmpevalUsersPeer::FNAME)) $criteria->add(EmpevalUsersPeer::FNAME, $this->fname);
        if ($this->isColumnModified(EmpevalUsersPeer::LNAME)) $criteria->add(EmpevalUsersPeer::LNAME, $this->lname);
        if ($this->isColumnModified(EmpevalUsersPeer::EMAIL)) $criteria->add(EmpevalUsersPeer::EMAIL, $this->email);
        if ($this->isColumnModified(EmpevalUsersPeer::OPTIONAL_EMAIL)) $criteria->add(EmpevalUsersPeer::OPTIONAL_EMAIL, $this->optional_email);
        if ($this->isColumnModified(EmpevalUsersPeer::PASSWORD)) $criteria->add(EmpevalUsersPeer::PASSWORD, $this->password);
        if ($this->isColumnModified(EmpevalUsersPeer::COMPANY)) $criteria->add(EmpevalUsersPeer::COMPANY, $this->company);
        if ($this->isColumnModified(EmpevalUsersPeer::PHONE)) $criteria->add(EmpevalUsersPeer::PHONE, $this->phone);
        if ($this->isColumnModified(EmpevalUsersPeer::MOBILE)) $criteria->add(EmpevalUsersPeer::MOBILE, $this->mobile);
        if ($this->isColumnModified(EmpevalUsersPeer::PHOTO)) $criteria->add(EmpevalUsersPeer::PHOTO, $this->photo);
        if ($this->isColumnModified(EmpevalUsersPeer::AD_LOGIN_1)) $criteria->add(EmpevalUsersPeer::AD_LOGIN_1, $this->ad_login_1);
        if ($this->isColumnModified(EmpevalUsersPeer::AD_LOGIN_2)) $criteria->add(EmpevalUsersPeer::AD_LOGIN_2, $this->ad_login_2);
        if ($this->isColumnModified(EmpevalUsersPeer::AD_LOGIN_3)) $criteria->add(EmpevalUsersPeer::AD_LOGIN_3, $this->ad_login_3);
        if ($this->isColumnModified(EmpevalUsersPeer::DELETED)) $criteria->add(EmpevalUsersPeer::DELETED, $this->deleted);
        if ($this->isColumnModified(EmpevalUsersPeer::ACTIVE)) $criteria->add(EmpevalUsersPeer::ACTIVE, $this->active);
        if ($this->isColumnModified(EmpevalUsersPeer::LAST_MODIFIED)) $criteria->add(EmpevalUsersPeer::LAST_MODIFIED, $this->last_modified);
        if ($this->isColumnModified(EmpevalUsersPeer::CREATED)) $criteria->add(EmpevalUsersPeer::CREATED, $this->created);

        return $criteria;
    }

    /**
     * Builds a Criteria object containing the primary key for this object.
     *
     * Unlike buildCriteria() this method includes the primary key values regardless
     * of whether or not they have been modified.
     *
     * @return Criteria The Criteria object containing value(s) for primary key(s).
     */
    public function buildPkeyCriteria()
    {
        $criteria = new Criteria(EmpevalUsersPeer::DATABASE_NAME);
        $criteria->add(EmpevalUsersPeer::ID, $this->id);

        return $criteria;
    }

    /**
     * Returns the primary key for this object (row).
     * @return int
     */
    public function getPrimaryKey()
    {
        return $this->getId();
    }

    /**
     * Generic method to set the primary key (id column).
     *
     * @param  int $key Primary key.
     * @return void
     */
    public function setPrimaryKey($key)
    {
        $this->setId($key);
    }

    /**
     * Returns true if the primary key for this object is null.
     * @return boolean
     */
    public function isPrimaryKeyNull()
    {

        return null === $this->getId();
    }

    /**
     * Sets contents of passed object to values from current object.
     *
     * If desired, this method can also make copies of all associated (fkey referrers)
     * objects.
     *
     * @param object $copyObj An object of EmpevalUsers (or compatible) type.
     * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
     * @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
     * @throws PropelException
     */
    public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
    {
        $copyObj->setExtId($this->getExtId());
        $copyObj->setFname($this->getFname());
        $copyObj->setLname($this->getLname());
        $copyObj->setEmail($this->getEmail());
        $copyObj->setOptionalEmail($this->getOptionalEmail());
        $copyObj->setPassword($this->getPassword());
        $copyObj->setCompany($this->getCompany());
        $copyObj->setPhone($this->getPhone());
        $copyObj->setMobile($this->getMobile());
        $copyObj->setPhoto($this->getPhoto());
        $copyObj->setAdLogin1($this->getAdLogin1());
        $copyObj->setAdLogin2($this->getAdLogin2());
        $copyObj->setAdLogin3($this->getAdLogin3());
        $copyObj->setDeleted($this->getDeleted());
        $copyObj->setActive($this->getActive());
        $copyObj->setLastModified($this->getLastModified());
        $copyObj->setCreated($this->getCreated());

        if ($deepCopy && !$this->startCopy) {
            // important: temporarily setNew(false) because this affects the behavior of
            // the getter/setter methods for fkey referrer objects.
            $copyObj->setNew(false);
            // store object hash to prevent cycle
            $this->startCopy = true;

            foreach ($this->getBonusGoalsFormss() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addBonusGoalsForms($relObj->copy($deepCopy));
                }
            }

            foreach ($this->getSummarys() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addSummary($relObj->copy($deepCopy));
                }
            }

            foreach ($this->getEmployeeEvaluationss() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addEmployeeEvaluations($relObj->copy($deepCopy));
                }
            }

            foreach ($this->getUserRolessRelatedByFormUserId() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addUserRolesRelatedByFormUserId($relObj->copy($deepCopy));
                }
            }

            foreach ($this->getUserRolessRelatedByToUserId() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addUserRolesRelatedByToUserId($relObj->copy($deepCopy));
                }
            }

            foreach ($this->getCommitteess() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addCommittees($relObj->copy($deepCopy));
                }
            }

            foreach ($this->getUserPositionss() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addUserPositions($relObj->copy($deepCopy));
                }
            }

            foreach ($this->getAcceptances() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addAcceptance($relObj->copy($deepCopy));
                }
            }

            foreach ($this->getViewBgfWithSuperiorPositionIds() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addViewBgfWithSuperiorPositionId($relObj->copy($deepCopy));
                }
            }

            foreach ($this->getNotificationUserss() as $relObj) {
                if ($relObj !== $this) {  // ensure that we don't try to copy a reference to ourselves
                    $copyObj->addNotificationUsers($relObj->copy($deepCopy));
                }
            }

            //unflag object copy
            $this->startCopy = false;
        } // if ($deepCopy)

        if ($makeNew) {
            $copyObj->setNew(true);
            $copyObj->setId(NULL); // this is a auto-increment column, so set to default value
        }
    }

    /**
     * Makes a copy of this object that will be inserted as a new row in table when saved.
     * It creates a new object filling in the simple attributes, but skipping any primary
     * keys that are defined for the table.
     *
     * If desired, this method can also make copies of all associated (fkey referrers)
     * objects.
     *
     * @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
     * @return EmpevalUsers Clone of current object.
     * @throws PropelException
     */
    public function copy($deepCopy = false)
    {
        // we use get_class(), because this might be a subclass
        $clazz = get_class($this);
        $copyObj = new $clazz();
        $this->copyInto($copyObj, $deepCopy);

        return $copyObj;
    }

    /**
     * Returns a peer instance associated with this om.
     *
     * Since Peer classes are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     *
     * @return EmpevalUsersPeer
     */
    public function getPeer()
    {
        if (self::$peer === null) {
            self::$peer = new EmpevalUsersPeer();
        }

        return self::$peer;
    }


    /**
     * Initializes a collection based on the name of a relation.
     * Avoids crafting an 'init[$relationName]s' method name
     * that wouldn't work when StandardEnglishPluralizer is used.
     *
     * @param string $relationName The name of the relation to initialize
     * @return void
     */
    public function initRelation($relationName)
    {
        if ('BonusGoalsForms' == $relationName) {
            $this->initBonusGoalsFormss();
        }
        if ('Summary' == $relationName) {
            $this->initSummarys();
        }
        if ('EmployeeEvaluations' == $relationName) {
            $this->initEmployeeEvaluationss();
        }
        if ('UserRolesRelatedByFormUserId' == $relationName) {
            $this->initUserRolessRelatedByFormUserId();
        }
        if ('UserRolesRelatedByToUserId' == $relationName) {
            $this->initUserRolessRelatedByToUserId();
        }
        if ('Committees' == $relationName) {
            $this->initCommitteess();
        }
        if ('UserPositions' == $relationName) {
            $this->initUserPositionss();
        }
        if ('Acceptance' == $relationName) {
            $this->initAcceptances();
        }
        if ('ViewBgfWithSuperiorPositionId' == $relationName) {
            $this->initViewBgfWithSuperiorPositionIds();
        }
        if ('NotificationUsers' == $relationName) {
            $this->initNotificationUserss();
        }
    }

    /**
     * Clears out the collBonusGoalsFormss collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addBonusGoalsFormss()
     */
    public function clearBonusGoalsFormss()
    {
        $this->collBonusGoalsFormss = null; // important to set this to null since that means it is uninitialized
        $this->collBonusGoalsFormssPartial = null;
    }

    /**
     * reset is the collBonusGoalsFormss collection loaded partially
     *
     * @return void
     */
    public function resetPartialBonusGoalsFormss($v = true)
    {
        $this->collBonusGoalsFormssPartial = $v;
    }

    /**
     * Initializes the collBonusGoalsFormss collection.
     *
     * By default this just sets the collBonusGoalsFormss collection to an empty array (like clearcollBonusGoalsFormss());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initBonusGoalsFormss($overrideExisting = true)
    {
        if (null !== $this->collBonusGoalsFormss && !$overrideExisting) {
            return;
        }
        $this->collBonusGoalsFormss = new PropelObjectCollection();
        $this->collBonusGoalsFormss->setModel('EmpevalBonusGoalsForms');
    }

    /**
     * Gets an array of EmpevalBonusGoalsForms objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalBonusGoalsForms[] List of EmpevalBonusGoalsForms objects
     * @throws PropelException
     */
    public function getBonusGoalsFormss($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collBonusGoalsFormssPartial && !$this->isNew();
        if (null === $this->collBonusGoalsFormss || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collBonusGoalsFormss) {
                // return empty collection
                $this->initBonusGoalsFormss();
            } else {
                $collBonusGoalsFormss = EmpevalBonusGoalsFormsQuery::create(null, $criteria)
                    ->filterByUsers($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collBonusGoalsFormssPartial && count($collBonusGoalsFormss)) {
                      $this->initBonusGoalsFormss(false);

                      foreach($collBonusGoalsFormss as $obj) {
                        if (false == $this->collBonusGoalsFormss->contains($obj)) {
                          $this->collBonusGoalsFormss->append($obj);
                        }
                      }

                      $this->collBonusGoalsFormssPartial = true;
                    }

                    return $collBonusGoalsFormss;
                }

                if($partial && $this->collBonusGoalsFormss) {
                    foreach($this->collBonusGoalsFormss as $obj) {
                        if($obj->isNew()) {
                            $collBonusGoalsFormss[] = $obj;
                        }
                    }
                }

                $this->collBonusGoalsFormss = $collBonusGoalsFormss;
                $this->collBonusGoalsFormssPartial = false;
            }
        }

        return $this->collBonusGoalsFormss;
    }

    /**
     * Sets a collection of BonusGoalsForms objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $bonusGoalsFormss A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setBonusGoalsFormss(PropelCollection $bonusGoalsFormss, PropelPDO $con = null)
    {
        $this->bonusGoalsFormssScheduledForDeletion = $this->getBonusGoalsFormss(new Criteria(), $con)->diff($bonusGoalsFormss);

        foreach ($this->bonusGoalsFormssScheduledForDeletion as $bonusGoalsFormsRemoved) {
            $bonusGoalsFormsRemoved->setUsers(null);
        }

        $this->collBonusGoalsFormss = null;
        foreach ($bonusGoalsFormss as $bonusGoalsForms) {
            $this->addBonusGoalsForms($bonusGoalsForms);
        }

        $this->collBonusGoalsFormss = $bonusGoalsFormss;
        $this->collBonusGoalsFormssPartial = false;
    }

    /**
     * Returns the number of related EmpevalBonusGoalsForms objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalBonusGoalsForms objects.
     * @throws PropelException
     */
    public function countBonusGoalsFormss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collBonusGoalsFormssPartial && !$this->isNew();
        if (null === $this->collBonusGoalsFormss || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collBonusGoalsFormss) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getBonusGoalsFormss());
                }
                $query = EmpevalBonusGoalsFormsQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsers($this)
                    ->count($con);
            }
        } else {
            return count($this->collBonusGoalsFormss);
        }
    }

    /**
     * Method called to associate a EmpevalBonusGoalsForms object to this object
     * through the EmpevalBonusGoalsForms foreign key attribute.
     *
     * @param    EmpevalBonusGoalsForms $l EmpevalBonusGoalsForms
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addBonusGoalsForms(EmpevalBonusGoalsForms $l)
    {
        if ($this->collBonusGoalsFormss === null) {
            $this->initBonusGoalsFormss();
            $this->collBonusGoalsFormssPartial = true;
        }
        if (!$this->collBonusGoalsFormss->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddBonusGoalsForms($l);
        }

        return $this;
    }

    /**
     * @param	BonusGoalsForms $bonusGoalsForms The bonusGoalsForms object to add.
     */
    protected function doAddBonusGoalsForms($bonusGoalsForms)
    {
        $this->collBonusGoalsFormss[]= $bonusGoalsForms;
        $bonusGoalsForms->setUsers($this);
    }

    /**
     * @param	BonusGoalsForms $bonusGoalsForms The bonusGoalsForms object to remove.
     */
    public function removeBonusGoalsForms($bonusGoalsForms)
    {
        if ($this->getBonusGoalsFormss()->contains($bonusGoalsForms)) {
            $this->collBonusGoalsFormss->remove($this->collBonusGoalsFormss->search($bonusGoalsForms));
            if (null === $this->bonusGoalsFormssScheduledForDeletion) {
                $this->bonusGoalsFormssScheduledForDeletion = clone $this->collBonusGoalsFormss;
                $this->bonusGoalsFormssScheduledForDeletion->clear();
            }
            $this->bonusGoalsFormssScheduledForDeletion[]= $bonusGoalsForms;
            $bonusGoalsForms->setUsers(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related BonusGoalsFormss from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalBonusGoalsForms[] List of EmpevalBonusGoalsForms objects
     */
    public function getBonusGoalsFormssJoinBonusPeriods($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalBonusGoalsFormsQuery::create(null, $criteria);
        $query->joinWith('BonusPeriods', $join_behavior);

        return $this->getBonusGoalsFormss($query, $con);
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related BonusGoalsFormss from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalBonusGoalsForms[] List of EmpevalBonusGoalsForms objects
     */
    public function getBonusGoalsFormssJoinUserPositions($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalBonusGoalsFormsQuery::create(null, $criteria);
        $query->joinWith('UserPositions', $join_behavior);

        return $this->getBonusGoalsFormss($query, $con);
    }

    /**
     * Clears out the collSummarys collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addSummarys()
     */
    public function clearSummarys()
    {
        $this->collSummarys = null; // important to set this to null since that means it is uninitialized
        $this->collSummarysPartial = null;
    }

    /**
     * reset is the collSummarys collection loaded partially
     *
     * @return void
     */
    public function resetPartialSummarys($v = true)
    {
        $this->collSummarysPartial = $v;
    }

    /**
     * Initializes the collSummarys collection.
     *
     * By default this just sets the collSummarys collection to an empty array (like clearcollSummarys());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initSummarys($overrideExisting = true)
    {
        if (null !== $this->collSummarys && !$overrideExisting) {
            return;
        }
        $this->collSummarys = new PropelObjectCollection();
        $this->collSummarys->setModel('EmpevalSummary');
    }

    /**
     * Gets an array of EmpevalSummary objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalSummary[] List of EmpevalSummary objects
     * @throws PropelException
     */
    public function getSummarys($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collSummarysPartial && !$this->isNew();
        if (null === $this->collSummarys || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collSummarys) {
                // return empty collection
                $this->initSummarys();
            } else {
                $collSummarys = EmpevalSummaryQuery::create(null, $criteria)
                    ->filterByUsers($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collSummarysPartial && count($collSummarys)) {
                      $this->initSummarys(false);

                      foreach($collSummarys as $obj) {
                        if (false == $this->collSummarys->contains($obj)) {
                          $this->collSummarys->append($obj);
                        }
                      }

                      $this->collSummarysPartial = true;
                    }

                    return $collSummarys;
                }

                if($partial && $this->collSummarys) {
                    foreach($this->collSummarys as $obj) {
                        if($obj->isNew()) {
                            $collSummarys[] = $obj;
                        }
                    }
                }

                $this->collSummarys = $collSummarys;
                $this->collSummarysPartial = false;
            }
        }

        return $this->collSummarys;
    }

    /**
     * Sets a collection of Summary objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $summarys A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setSummarys(PropelCollection $summarys, PropelPDO $con = null)
    {
        $this->summarysScheduledForDeletion = $this->getSummarys(new Criteria(), $con)->diff($summarys);

        foreach ($this->summarysScheduledForDeletion as $summaryRemoved) {
            $summaryRemoved->setUsers(null);
        }

        $this->collSummarys = null;
        foreach ($summarys as $summary) {
            $this->addSummary($summary);
        }

        $this->collSummarys = $summarys;
        $this->collSummarysPartial = false;
    }

    /**
     * Returns the number of related EmpevalSummary objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalSummary objects.
     * @throws PropelException
     */
    public function countSummarys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collSummarysPartial && !$this->isNew();
        if (null === $this->collSummarys || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collSummarys) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getSummarys());
                }
                $query = EmpevalSummaryQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsers($this)
                    ->count($con);
            }
        } else {
            return count($this->collSummarys);
        }
    }

    /**
     * Method called to associate a EmpevalSummary object to this object
     * through the EmpevalSummary foreign key attribute.
     *
     * @param    EmpevalSummary $l EmpevalSummary
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addSummary(EmpevalSummary $l)
    {
        if ($this->collSummarys === null) {
            $this->initSummarys();
            $this->collSummarysPartial = true;
        }
        if (!$this->collSummarys->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddSummary($l);
        }

        return $this;
    }

    /**
     * @param	Summary $summary The summary object to add.
     */
    protected function doAddSummary($summary)
    {
        $this->collSummarys[]= $summary;
        $summary->setUsers($this);
    }

    /**
     * @param	Summary $summary The summary object to remove.
     */
    public function removeSummary($summary)
    {
        if ($this->getSummarys()->contains($summary)) {
            $this->collSummarys->remove($this->collSummarys->search($summary));
            if (null === $this->summarysScheduledForDeletion) {
                $this->summarysScheduledForDeletion = clone $this->collSummarys;
                $this->summarysScheduledForDeletion->clear();
            }
            $this->summarysScheduledForDeletion[]= $summary;
            $summary->setUsers(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related Summarys from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalSummary[] List of EmpevalSummary objects
     */
    public function getSummarysJoinBonusGoalsForms($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalSummaryQuery::create(null, $criteria);
        $query->joinWith('BonusGoalsForms', $join_behavior);

        return $this->getSummarys($query, $con);
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related Summarys from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalSummary[] List of EmpevalSummary objects
     */
    public function getSummarysJoinViewBgfWithSuperiorPositionId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalSummaryQuery::create(null, $criteria);
        $query->joinWith('ViewBgfWithSuperiorPositionId', $join_behavior);

        return $this->getSummarys($query, $con);
    }

    /**
     * Clears out the collEmployeeEvaluationss collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addEmployeeEvaluationss()
     */
    public function clearEmployeeEvaluationss()
    {
        $this->collEmployeeEvaluationss = null; // important to set this to null since that means it is uninitialized
        $this->collEmployeeEvaluationssPartial = null;
    }

    /**
     * reset is the collEmployeeEvaluationss collection loaded partially
     *
     * @return void
     */
    public function resetPartialEmployeeEvaluationss($v = true)
    {
        $this->collEmployeeEvaluationssPartial = $v;
    }

    /**
     * Initializes the collEmployeeEvaluationss collection.
     *
     * By default this just sets the collEmployeeEvaluationss collection to an empty array (like clearcollEmployeeEvaluationss());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initEmployeeEvaluationss($overrideExisting = true)
    {
        if (null !== $this->collEmployeeEvaluationss && !$overrideExisting) {
            return;
        }
        $this->collEmployeeEvaluationss = new PropelObjectCollection();
        $this->collEmployeeEvaluationss->setModel('EmpevalEmployeeEvaluations');
    }

    /**
     * Gets an array of EmpevalEmployeeEvaluations objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalEmployeeEvaluations[] List of EmpevalEmployeeEvaluations objects
     * @throws PropelException
     */
    public function getEmployeeEvaluationss($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collEmployeeEvaluationssPartial && !$this->isNew();
        if (null === $this->collEmployeeEvaluationss || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collEmployeeEvaluationss) {
                // return empty collection
                $this->initEmployeeEvaluationss();
            } else {
                $collEmployeeEvaluationss = EmpevalEmployeeEvaluationsQuery::create(null, $criteria)
                    ->filterByUsers($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collEmployeeEvaluationssPartial && count($collEmployeeEvaluationss)) {
                      $this->initEmployeeEvaluationss(false);

                      foreach($collEmployeeEvaluationss as $obj) {
                        if (false == $this->collEmployeeEvaluationss->contains($obj)) {
                          $this->collEmployeeEvaluationss->append($obj);
                        }
                      }

                      $this->collEmployeeEvaluationssPartial = true;
                    }

                    return $collEmployeeEvaluationss;
                }

                if($partial && $this->collEmployeeEvaluationss) {
                    foreach($this->collEmployeeEvaluationss as $obj) {
                        if($obj->isNew()) {
                            $collEmployeeEvaluationss[] = $obj;
                        }
                    }
                }

                $this->collEmployeeEvaluationss = $collEmployeeEvaluationss;
                $this->collEmployeeEvaluationssPartial = false;
            }
        }

        return $this->collEmployeeEvaluationss;
    }

    /**
     * Sets a collection of EmployeeEvaluations objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $employeeEvaluationss A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setEmployeeEvaluationss(PropelCollection $employeeEvaluationss, PropelPDO $con = null)
    {
        $this->employeeEvaluationssScheduledForDeletion = $this->getEmployeeEvaluationss(new Criteria(), $con)->diff($employeeEvaluationss);

        foreach ($this->employeeEvaluationssScheduledForDeletion as $employeeEvaluationsRemoved) {
            $employeeEvaluationsRemoved->setUsers(null);
        }

        $this->collEmployeeEvaluationss = null;
        foreach ($employeeEvaluationss as $employeeEvaluations) {
            $this->addEmployeeEvaluations($employeeEvaluations);
        }

        $this->collEmployeeEvaluationss = $employeeEvaluationss;
        $this->collEmployeeEvaluationssPartial = false;
    }

    /**
     * Returns the number of related EmpevalEmployeeEvaluations objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalEmployeeEvaluations objects.
     * @throws PropelException
     */
    public function countEmployeeEvaluationss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collEmployeeEvaluationssPartial && !$this->isNew();
        if (null === $this->collEmployeeEvaluationss || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collEmployeeEvaluationss) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getEmployeeEvaluationss());
                }
                $query = EmpevalEmployeeEvaluationsQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsers($this)
                    ->count($con);
            }
        } else {
            return count($this->collEmployeeEvaluationss);
        }
    }

    /**
     * Method called to associate a EmpevalEmployeeEvaluations object to this object
     * through the EmpevalEmployeeEvaluations foreign key attribute.
     *
     * @param    EmpevalEmployeeEvaluations $l EmpevalEmployeeEvaluations
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addEmployeeEvaluations(EmpevalEmployeeEvaluations $l)
    {
        if ($this->collEmployeeEvaluationss === null) {
            $this->initEmployeeEvaluationss();
            $this->collEmployeeEvaluationssPartial = true;
        }
        if (!$this->collEmployeeEvaluationss->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddEmployeeEvaluations($l);
        }

        return $this;
    }

    /**
     * @param	EmployeeEvaluations $employeeEvaluations The employeeEvaluations object to add.
     */
    protected function doAddEmployeeEvaluations($employeeEvaluations)
    {
        $this->collEmployeeEvaluationss[]= $employeeEvaluations;
        $employeeEvaluations->setUsers($this);
    }

    /**
     * @param	EmployeeEvaluations $employeeEvaluations The employeeEvaluations object to remove.
     */
    public function removeEmployeeEvaluations($employeeEvaluations)
    {
        if ($this->getEmployeeEvaluationss()->contains($employeeEvaluations)) {
            $this->collEmployeeEvaluationss->remove($this->collEmployeeEvaluationss->search($employeeEvaluations));
            if (null === $this->employeeEvaluationssScheduledForDeletion) {
                $this->employeeEvaluationssScheduledForDeletion = clone $this->collEmployeeEvaluationss;
                $this->employeeEvaluationssScheduledForDeletion->clear();
            }
            $this->employeeEvaluationssScheduledForDeletion[]= $employeeEvaluations;
            $employeeEvaluations->setUsers(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related EmployeeEvaluationss from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalEmployeeEvaluations[] List of EmpevalEmployeeEvaluations objects
     */
    public function getEmployeeEvaluationssJoinBonusGoalsForms($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalEmployeeEvaluationsQuery::create(null, $criteria);
        $query->joinWith('BonusGoalsForms', $join_behavior);

        return $this->getEmployeeEvaluationss($query, $con);
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related EmployeeEvaluationss from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalEmployeeEvaluations[] List of EmpevalEmployeeEvaluations objects
     */
    public function getEmployeeEvaluationssJoinViewBgfWithSuperiorPositionId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalEmployeeEvaluationsQuery::create(null, $criteria);
        $query->joinWith('ViewBgfWithSuperiorPositionId', $join_behavior);

        return $this->getEmployeeEvaluationss($query, $con);
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related EmployeeEvaluationss from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalEmployeeEvaluations[] List of EmpevalEmployeeEvaluations objects
     */
    public function getEmployeeEvaluationssJoinEvaluations($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalEmployeeEvaluationsQuery::create(null, $criteria);
        $query->joinWith('Evaluations', $join_behavior);

        return $this->getEmployeeEvaluationss($query, $con);
    }

    /**
     * Clears out the collUserRolessRelatedByFormUserId collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addUserRolessRelatedByFormUserId()
     */
    public function clearUserRolessRelatedByFormUserId()
    {
        $this->collUserRolessRelatedByFormUserId = null; // important to set this to null since that means it is uninitialized
        $this->collUserRolessRelatedByFormUserIdPartial = null;
    }

    /**
     * reset is the collUserRolessRelatedByFormUserId collection loaded partially
     *
     * @return void
     */
    public function resetPartialUserRolessRelatedByFormUserId($v = true)
    {
        $this->collUserRolessRelatedByFormUserIdPartial = $v;
    }

    /**
     * Initializes the collUserRolessRelatedByFormUserId collection.
     *
     * By default this just sets the collUserRolessRelatedByFormUserId collection to an empty array (like clearcollUserRolessRelatedByFormUserId());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initUserRolessRelatedByFormUserId($overrideExisting = true)
    {
        if (null !== $this->collUserRolessRelatedByFormUserId && !$overrideExisting) {
            return;
        }
        $this->collUserRolessRelatedByFormUserId = new PropelObjectCollection();
        $this->collUserRolessRelatedByFormUserId->setModel('EmpevalUserRoles');
    }

    /**
     * Gets an array of EmpevalUserRoles objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalUserRoles[] List of EmpevalUserRoles objects
     * @throws PropelException
     */
    public function getUserRolessRelatedByFormUserId($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collUserRolessRelatedByFormUserIdPartial && !$this->isNew();
        if (null === $this->collUserRolessRelatedByFormUserId || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collUserRolessRelatedByFormUserId) {
                // return empty collection
                $this->initUserRolessRelatedByFormUserId();
            } else {
                $collUserRolessRelatedByFormUserId = EmpevalUserRolesQuery::create(null, $criteria)
                    ->filterByUsersRelatedByFormUserId($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collUserRolessRelatedByFormUserIdPartial && count($collUserRolessRelatedByFormUserId)) {
                      $this->initUserRolessRelatedByFormUserId(false);

                      foreach($collUserRolessRelatedByFormUserId as $obj) {
                        if (false == $this->collUserRolessRelatedByFormUserId->contains($obj)) {
                          $this->collUserRolessRelatedByFormUserId->append($obj);
                        }
                      }

                      $this->collUserRolessRelatedByFormUserIdPartial = true;
                    }

                    return $collUserRolessRelatedByFormUserId;
                }

                if($partial && $this->collUserRolessRelatedByFormUserId) {
                    foreach($this->collUserRolessRelatedByFormUserId as $obj) {
                        if($obj->isNew()) {
                            $collUserRolessRelatedByFormUserId[] = $obj;
                        }
                    }
                }

                $this->collUserRolessRelatedByFormUserId = $collUserRolessRelatedByFormUserId;
                $this->collUserRolessRelatedByFormUserIdPartial = false;
            }
        }

        return $this->collUserRolessRelatedByFormUserId;
    }

    /**
     * Sets a collection of UserRolesRelatedByFormUserId objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $userRolessRelatedByFormUserId A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setUserRolessRelatedByFormUserId(PropelCollection $userRolessRelatedByFormUserId, PropelPDO $con = null)
    {
        $this->userRolessRelatedByFormUserIdScheduledForDeletion = $this->getUserRolessRelatedByFormUserId(new Criteria(), $con)->diff($userRolessRelatedByFormUserId);

        foreach ($this->userRolessRelatedByFormUserIdScheduledForDeletion as $userRolesRelatedByFormUserIdRemoved) {
            $userRolesRelatedByFormUserIdRemoved->setUsersRelatedByFormUserId(null);
        }

        $this->collUserRolessRelatedByFormUserId = null;
        foreach ($userRolessRelatedByFormUserId as $userRolesRelatedByFormUserId) {
            $this->addUserRolesRelatedByFormUserId($userRolesRelatedByFormUserId);
        }

        $this->collUserRolessRelatedByFormUserId = $userRolessRelatedByFormUserId;
        $this->collUserRolessRelatedByFormUserIdPartial = false;
    }

    /**
     * Returns the number of related EmpevalUserRoles objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalUserRoles objects.
     * @throws PropelException
     */
    public function countUserRolessRelatedByFormUserId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collUserRolessRelatedByFormUserIdPartial && !$this->isNew();
        if (null === $this->collUserRolessRelatedByFormUserId || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collUserRolessRelatedByFormUserId) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getUserRolessRelatedByFormUserId());
                }
                $query = EmpevalUserRolesQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsersRelatedByFormUserId($this)
                    ->count($con);
            }
        } else {
            return count($this->collUserRolessRelatedByFormUserId);
        }
    }

    /**
     * Method called to associate a EmpevalUserRoles object to this object
     * through the EmpevalUserRoles foreign key attribute.
     *
     * @param    EmpevalUserRoles $l EmpevalUserRoles
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addUserRolesRelatedByFormUserId(EmpevalUserRoles $l)
    {
        if ($this->collUserRolessRelatedByFormUserId === null) {
            $this->initUserRolessRelatedByFormUserId();
            $this->collUserRolessRelatedByFormUserIdPartial = true;
        }
        if (!$this->collUserRolessRelatedByFormUserId->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddUserRolesRelatedByFormUserId($l);
        }

        return $this;
    }

    /**
     * @param	UserRolesRelatedByFormUserId $userRolesRelatedByFormUserId The userRolesRelatedByFormUserId object to add.
     */
    protected function doAddUserRolesRelatedByFormUserId($userRolesRelatedByFormUserId)
    {
        $this->collUserRolessRelatedByFormUserId[]= $userRolesRelatedByFormUserId;
        $userRolesRelatedByFormUserId->setUsersRelatedByFormUserId($this);
    }

    /**
     * @param	UserRolesRelatedByFormUserId $userRolesRelatedByFormUserId The userRolesRelatedByFormUserId object to remove.
     */
    public function removeUserRolesRelatedByFormUserId($userRolesRelatedByFormUserId)
    {
        if ($this->getUserRolessRelatedByFormUserId()->contains($userRolesRelatedByFormUserId)) {
            $this->collUserRolessRelatedByFormUserId->remove($this->collUserRolessRelatedByFormUserId->search($userRolesRelatedByFormUserId));
            if (null === $this->userRolessRelatedByFormUserIdScheduledForDeletion) {
                $this->userRolessRelatedByFormUserIdScheduledForDeletion = clone $this->collUserRolessRelatedByFormUserId;
                $this->userRolessRelatedByFormUserIdScheduledForDeletion->clear();
            }
            $this->userRolessRelatedByFormUserIdScheduledForDeletion[]= $userRolesRelatedByFormUserId;
            $userRolesRelatedByFormUserId->setUsersRelatedByFormUserId(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related UserRolessRelatedByFormUserId from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalUserRoles[] List of EmpevalUserRoles objects
     */
    public function getUserRolessRelatedByFormUserIdJoinRoles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalUserRolesQuery::create(null, $criteria);
        $query->joinWith('Roles', $join_behavior);

        return $this->getUserRolessRelatedByFormUserId($query, $con);
    }

    /**
     * Clears out the collUserRolessRelatedByToUserId collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addUserRolessRelatedByToUserId()
     */
    public function clearUserRolessRelatedByToUserId()
    {
        $this->collUserRolessRelatedByToUserId = null; // important to set this to null since that means it is uninitialized
        $this->collUserRolessRelatedByToUserIdPartial = null;
    }

    /**
     * reset is the collUserRolessRelatedByToUserId collection loaded partially
     *
     * @return void
     */
    public function resetPartialUserRolessRelatedByToUserId($v = true)
    {
        $this->collUserRolessRelatedByToUserIdPartial = $v;
    }

    /**
     * Initializes the collUserRolessRelatedByToUserId collection.
     *
     * By default this just sets the collUserRolessRelatedByToUserId collection to an empty array (like clearcollUserRolessRelatedByToUserId());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initUserRolessRelatedByToUserId($overrideExisting = true)
    {
        if (null !== $this->collUserRolessRelatedByToUserId && !$overrideExisting) {
            return;
        }
        $this->collUserRolessRelatedByToUserId = new PropelObjectCollection();
        $this->collUserRolessRelatedByToUserId->setModel('EmpevalUserRoles');
    }

    /**
     * Gets an array of EmpevalUserRoles objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalUserRoles[] List of EmpevalUserRoles objects
     * @throws PropelException
     */
    public function getUserRolessRelatedByToUserId($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collUserRolessRelatedByToUserIdPartial && !$this->isNew();
        if (null === $this->collUserRolessRelatedByToUserId || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collUserRolessRelatedByToUserId) {
                // return empty collection
                $this->initUserRolessRelatedByToUserId();
            } else {
                $collUserRolessRelatedByToUserId = EmpevalUserRolesQuery::create(null, $criteria)
                    ->filterByUsersRelatedByToUserId($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collUserRolessRelatedByToUserIdPartial && count($collUserRolessRelatedByToUserId)) {
                      $this->initUserRolessRelatedByToUserId(false);

                      foreach($collUserRolessRelatedByToUserId as $obj) {
                        if (false == $this->collUserRolessRelatedByToUserId->contains($obj)) {
                          $this->collUserRolessRelatedByToUserId->append($obj);
                        }
                      }

                      $this->collUserRolessRelatedByToUserIdPartial = true;
                    }

                    return $collUserRolessRelatedByToUserId;
                }

                if($partial && $this->collUserRolessRelatedByToUserId) {
                    foreach($this->collUserRolessRelatedByToUserId as $obj) {
                        if($obj->isNew()) {
                            $collUserRolessRelatedByToUserId[] = $obj;
                        }
                    }
                }

                $this->collUserRolessRelatedByToUserId = $collUserRolessRelatedByToUserId;
                $this->collUserRolessRelatedByToUserIdPartial = false;
            }
        }

        return $this->collUserRolessRelatedByToUserId;
    }

    /**
     * Sets a collection of UserRolesRelatedByToUserId objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $userRolessRelatedByToUserId A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setUserRolessRelatedByToUserId(PropelCollection $userRolessRelatedByToUserId, PropelPDO $con = null)
    {
        $this->userRolessRelatedByToUserIdScheduledForDeletion = $this->getUserRolessRelatedByToUserId(new Criteria(), $con)->diff($userRolessRelatedByToUserId);

        foreach ($this->userRolessRelatedByToUserIdScheduledForDeletion as $userRolesRelatedByToUserIdRemoved) {
            $userRolesRelatedByToUserIdRemoved->setUsersRelatedByToUserId(null);
        }

        $this->collUserRolessRelatedByToUserId = null;
        foreach ($userRolessRelatedByToUserId as $userRolesRelatedByToUserId) {
            $this->addUserRolesRelatedByToUserId($userRolesRelatedByToUserId);
        }

        $this->collUserRolessRelatedByToUserId = $userRolessRelatedByToUserId;
        $this->collUserRolessRelatedByToUserIdPartial = false;
    }

    /**
     * Returns the number of related EmpevalUserRoles objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalUserRoles objects.
     * @throws PropelException
     */
    public function countUserRolessRelatedByToUserId(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collUserRolessRelatedByToUserIdPartial && !$this->isNew();
        if (null === $this->collUserRolessRelatedByToUserId || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collUserRolessRelatedByToUserId) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getUserRolessRelatedByToUserId());
                }
                $query = EmpevalUserRolesQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsersRelatedByToUserId($this)
                    ->count($con);
            }
        } else {
            return count($this->collUserRolessRelatedByToUserId);
        }
    }

    /**
     * Method called to associate a EmpevalUserRoles object to this object
     * through the EmpevalUserRoles foreign key attribute.
     *
     * @param    EmpevalUserRoles $l EmpevalUserRoles
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addUserRolesRelatedByToUserId(EmpevalUserRoles $l)
    {
        if ($this->collUserRolessRelatedByToUserId === null) {
            $this->initUserRolessRelatedByToUserId();
            $this->collUserRolessRelatedByToUserIdPartial = true;
        }
        if (!$this->collUserRolessRelatedByToUserId->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddUserRolesRelatedByToUserId($l);
        }

        return $this;
    }

    /**
     * @param	UserRolesRelatedByToUserId $userRolesRelatedByToUserId The userRolesRelatedByToUserId object to add.
     */
    protected function doAddUserRolesRelatedByToUserId($userRolesRelatedByToUserId)
    {
        $this->collUserRolessRelatedByToUserId[]= $userRolesRelatedByToUserId;
        $userRolesRelatedByToUserId->setUsersRelatedByToUserId($this);
    }

    /**
     * @param	UserRolesRelatedByToUserId $userRolesRelatedByToUserId The userRolesRelatedByToUserId object to remove.
     */
    public function removeUserRolesRelatedByToUserId($userRolesRelatedByToUserId)
    {
        if ($this->getUserRolessRelatedByToUserId()->contains($userRolesRelatedByToUserId)) {
            $this->collUserRolessRelatedByToUserId->remove($this->collUserRolessRelatedByToUserId->search($userRolesRelatedByToUserId));
            if (null === $this->userRolessRelatedByToUserIdScheduledForDeletion) {
                $this->userRolessRelatedByToUserIdScheduledForDeletion = clone $this->collUserRolessRelatedByToUserId;
                $this->userRolessRelatedByToUserIdScheduledForDeletion->clear();
            }
            $this->userRolessRelatedByToUserIdScheduledForDeletion[]= $userRolesRelatedByToUserId;
            $userRolesRelatedByToUserId->setUsersRelatedByToUserId(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related UserRolessRelatedByToUserId from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalUserRoles[] List of EmpevalUserRoles objects
     */
    public function getUserRolessRelatedByToUserIdJoinRoles($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalUserRolesQuery::create(null, $criteria);
        $query->joinWith('Roles', $join_behavior);

        return $this->getUserRolessRelatedByToUserId($query, $con);
    }

    /**
     * Clears out the collCommitteess collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addCommitteess()
     */
    public function clearCommitteess()
    {
        $this->collCommitteess = null; // important to set this to null since that means it is uninitialized
        $this->collCommitteessPartial = null;
    }

    /**
     * reset is the collCommitteess collection loaded partially
     *
     * @return void
     */
    public function resetPartialCommitteess($v = true)
    {
        $this->collCommitteessPartial = $v;
    }

    /**
     * Initializes the collCommitteess collection.
     *
     * By default this just sets the collCommitteess collection to an empty array (like clearcollCommitteess());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initCommitteess($overrideExisting = true)
    {
        if (null !== $this->collCommitteess && !$overrideExisting) {
            return;
        }
        $this->collCommitteess = new PropelObjectCollection();
        $this->collCommitteess->setModel('EmpevalCommittees');
    }

    /**
     * Gets an array of EmpevalCommittees objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalCommittees[] List of EmpevalCommittees objects
     * @throws PropelException
     */
    public function getCommitteess($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collCommitteessPartial && !$this->isNew();
        if (null === $this->collCommitteess || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collCommitteess) {
                // return empty collection
                $this->initCommitteess();
            } else {
                $collCommitteess = EmpevalCommitteesQuery::create(null, $criteria)
                    ->filterByUsers($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collCommitteessPartial && count($collCommitteess)) {
                      $this->initCommitteess(false);

                      foreach($collCommitteess as $obj) {
                        if (false == $this->collCommitteess->contains($obj)) {
                          $this->collCommitteess->append($obj);
                        }
                      }

                      $this->collCommitteessPartial = true;
                    }

                    return $collCommitteess;
                }

                if($partial && $this->collCommitteess) {
                    foreach($this->collCommitteess as $obj) {
                        if($obj->isNew()) {
                            $collCommitteess[] = $obj;
                        }
                    }
                }

                $this->collCommitteess = $collCommitteess;
                $this->collCommitteessPartial = false;
            }
        }

        return $this->collCommitteess;
    }

    /**
     * Sets a collection of Committees objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $committeess A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setCommitteess(PropelCollection $committeess, PropelPDO $con = null)
    {
        $this->committeessScheduledForDeletion = $this->getCommitteess(new Criteria(), $con)->diff($committeess);

        foreach ($this->committeessScheduledForDeletion as $committeesRemoved) {
            $committeesRemoved->setUsers(null);
        }

        $this->collCommitteess = null;
        foreach ($committeess as $committees) {
            $this->addCommittees($committees);
        }

        $this->collCommitteess = $committeess;
        $this->collCommitteessPartial = false;
    }

    /**
     * Returns the number of related EmpevalCommittees objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalCommittees objects.
     * @throws PropelException
     */
    public function countCommitteess(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collCommitteessPartial && !$this->isNew();
        if (null === $this->collCommitteess || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collCommitteess) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getCommitteess());
                }
                $query = EmpevalCommitteesQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsers($this)
                    ->count($con);
            }
        } else {
            return count($this->collCommitteess);
        }
    }

    /**
     * Method called to associate a EmpevalCommittees object to this object
     * through the EmpevalCommittees foreign key attribute.
     *
     * @param    EmpevalCommittees $l EmpevalCommittees
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addCommittees(EmpevalCommittees $l)
    {
        if ($this->collCommitteess === null) {
            $this->initCommitteess();
            $this->collCommitteessPartial = true;
        }
        if (!$this->collCommitteess->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddCommittees($l);
        }

        return $this;
    }

    /**
     * @param	Committees $committees The committees object to add.
     */
    protected function doAddCommittees($committees)
    {
        $this->collCommitteess[]= $committees;
        $committees->setUsers($this);
    }

    /**
     * @param	Committees $committees The committees object to remove.
     */
    public function removeCommittees($committees)
    {
        if ($this->getCommitteess()->contains($committees)) {
            $this->collCommitteess->remove($this->collCommitteess->search($committees));
            if (null === $this->committeessScheduledForDeletion) {
                $this->committeessScheduledForDeletion = clone $this->collCommitteess;
                $this->committeessScheduledForDeletion->clear();
            }
            $this->committeessScheduledForDeletion[]= $committees;
            $committees->setUsers(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related Committeess from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalCommittees[] List of EmpevalCommittees objects
     */
    public function getCommitteessJoinRejections($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalCommitteesQuery::create(null, $criteria);
        $query->joinWith('Rejections', $join_behavior);

        return $this->getCommitteess($query, $con);
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related Committeess from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalCommittees[] List of EmpevalCommittees objects
     */
    public function getCommitteessJoinViewRejectionsReport($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalCommitteesQuery::create(null, $criteria);
        $query->joinWith('ViewRejectionsReport', $join_behavior);

        return $this->getCommitteess($query, $con);
    }

    /**
     * Clears out the collUserPositionss collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addUserPositionss()
     */
    public function clearUserPositionss()
    {
        $this->collUserPositionss = null; // important to set this to null since that means it is uninitialized
        $this->collUserPositionssPartial = null;
    }

    /**
     * reset is the collUserPositionss collection loaded partially
     *
     * @return void
     */
    public function resetPartialUserPositionss($v = true)
    {
        $this->collUserPositionssPartial = $v;
    }

    /**
     * Initializes the collUserPositionss collection.
     *
     * By default this just sets the collUserPositionss collection to an empty array (like clearcollUserPositionss());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initUserPositionss($overrideExisting = true)
    {
        if (null !== $this->collUserPositionss && !$overrideExisting) {
            return;
        }
        $this->collUserPositionss = new PropelObjectCollection();
        $this->collUserPositionss->setModel('EmpevalUserPositions');
    }

    /**
     * Gets an array of EmpevalUserPositions objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalUserPositions[] List of EmpevalUserPositions objects
     * @throws PropelException
     */
    public function getUserPositionss($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collUserPositionssPartial && !$this->isNew();
        if (null === $this->collUserPositionss || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collUserPositionss) {
                // return empty collection
                $this->initUserPositionss();
            } else {
                $collUserPositionss = EmpevalUserPositionsQuery::create(null, $criteria)
                    ->filterByUsers($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collUserPositionssPartial && count($collUserPositionss)) {
                      $this->initUserPositionss(false);

                      foreach($collUserPositionss as $obj) {
                        if (false == $this->collUserPositionss->contains($obj)) {
                          $this->collUserPositionss->append($obj);
                        }
                      }

                      $this->collUserPositionssPartial = true;
                    }

                    return $collUserPositionss;
                }

                if($partial && $this->collUserPositionss) {
                    foreach($this->collUserPositionss as $obj) {
                        if($obj->isNew()) {
                            $collUserPositionss[] = $obj;
                        }
                    }
                }

                $this->collUserPositionss = $collUserPositionss;
                $this->collUserPositionssPartial = false;
            }
        }

        return $this->collUserPositionss;
    }

    /**
     * Sets a collection of UserPositions objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $userPositionss A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setUserPositionss(PropelCollection $userPositionss, PropelPDO $con = null)
    {
        $this->userPositionssScheduledForDeletion = $this->getUserPositionss(new Criteria(), $con)->diff($userPositionss);

        foreach ($this->userPositionssScheduledForDeletion as $userPositionsRemoved) {
            $userPositionsRemoved->setUsers(null);
        }

        $this->collUserPositionss = null;
        foreach ($userPositionss as $userPositions) {
            $this->addUserPositions($userPositions);
        }

        $this->collUserPositionss = $userPositionss;
        $this->collUserPositionssPartial = false;
    }

    /**
     * Returns the number of related EmpevalUserPositions objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalUserPositions objects.
     * @throws PropelException
     */
    public function countUserPositionss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collUserPositionssPartial && !$this->isNew();
        if (null === $this->collUserPositionss || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collUserPositionss) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getUserPositionss());
                }
                $query = EmpevalUserPositionsQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsers($this)
                    ->count($con);
            }
        } else {
            return count($this->collUserPositionss);
        }
    }

    /**
     * Method called to associate a EmpevalUserPositions object to this object
     * through the EmpevalUserPositions foreign key attribute.
     *
     * @param    EmpevalUserPositions $l EmpevalUserPositions
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addUserPositions(EmpevalUserPositions $l)
    {
        if ($this->collUserPositionss === null) {
            $this->initUserPositionss();
            $this->collUserPositionssPartial = true;
        }
        if (!$this->collUserPositionss->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddUserPositions($l);
        }

        return $this;
    }

    /**
     * @param	UserPositions $userPositions The userPositions object to add.
     */
    protected function doAddUserPositions($userPositions)
    {
        $this->collUserPositionss[]= $userPositions;
        $userPositions->setUsers($this);
    }

    /**
     * @param	UserPositions $userPositions The userPositions object to remove.
     */
    public function removeUserPositions($userPositions)
    {
        if ($this->getUserPositionss()->contains($userPositions)) {
            $this->collUserPositionss->remove($this->collUserPositionss->search($userPositions));
            if (null === $this->userPositionssScheduledForDeletion) {
                $this->userPositionssScheduledForDeletion = clone $this->collUserPositionss;
                $this->userPositionssScheduledForDeletion->clear();
            }
            $this->userPositionssScheduledForDeletion[]= $userPositions;
            $userPositions->setUsers(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related UserPositionss from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalUserPositions[] List of EmpevalUserPositions objects
     */
    public function getUserPositionssJoinUnits($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalUserPositionsQuery::create(null, $criteria);
        $query->joinWith('Units', $join_behavior);

        return $this->getUserPositionss($query, $con);
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related UserPositionss from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalUserPositions[] List of EmpevalUserPositions objects
     */
    public function getUserPositionssJoinPositions($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalUserPositionsQuery::create(null, $criteria);
        $query->joinWith('Positions', $join_behavior);

        return $this->getUserPositionss($query, $con);
    }

    /**
     * Clears out the collAcceptances collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addAcceptances()
     */
    public function clearAcceptances()
    {
        $this->collAcceptances = null; // important to set this to null since that means it is uninitialized
        $this->collAcceptancesPartial = null;
    }

    /**
     * reset is the collAcceptances collection loaded partially
     *
     * @return void
     */
    public function resetPartialAcceptances($v = true)
    {
        $this->collAcceptancesPartial = $v;
    }

    /**
     * Initializes the collAcceptances collection.
     *
     * By default this just sets the collAcceptances collection to an empty array (like clearcollAcceptances());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initAcceptances($overrideExisting = true)
    {
        if (null !== $this->collAcceptances && !$overrideExisting) {
            return;
        }
        $this->collAcceptances = new PropelObjectCollection();
        $this->collAcceptances->setModel('EmpevalAcceptance');
    }

    /**
     * Gets an array of EmpevalAcceptance objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalAcceptance[] List of EmpevalAcceptance objects
     * @throws PropelException
     */
    public function getAcceptances($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collAcceptancesPartial && !$this->isNew();
        if (null === $this->collAcceptances || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collAcceptances) {
                // return empty collection
                $this->initAcceptances();
            } else {
                $collAcceptances = EmpevalAcceptanceQuery::create(null, $criteria)
                    ->filterByUsers($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collAcceptancesPartial && count($collAcceptances)) {
                      $this->initAcceptances(false);

                      foreach($collAcceptances as $obj) {
                        if (false == $this->collAcceptances->contains($obj)) {
                          $this->collAcceptances->append($obj);
                        }
                      }

                      $this->collAcceptancesPartial = true;
                    }

                    return $collAcceptances;
                }

                if($partial && $this->collAcceptances) {
                    foreach($this->collAcceptances as $obj) {
                        if($obj->isNew()) {
                            $collAcceptances[] = $obj;
                        }
                    }
                }

                $this->collAcceptances = $collAcceptances;
                $this->collAcceptancesPartial = false;
            }
        }

        return $this->collAcceptances;
    }

    /**
     * Sets a collection of Acceptance objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $acceptances A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setAcceptances(PropelCollection $acceptances, PropelPDO $con = null)
    {
        $this->acceptancesScheduledForDeletion = $this->getAcceptances(new Criteria(), $con)->diff($acceptances);

        foreach ($this->acceptancesScheduledForDeletion as $acceptanceRemoved) {
            $acceptanceRemoved->setUsers(null);
        }

        $this->collAcceptances = null;
        foreach ($acceptances as $acceptance) {
            $this->addAcceptance($acceptance);
        }

        $this->collAcceptances = $acceptances;
        $this->collAcceptancesPartial = false;
    }

    /**
     * Returns the number of related EmpevalAcceptance objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalAcceptance objects.
     * @throws PropelException
     */
    public function countAcceptances(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collAcceptancesPartial && !$this->isNew();
        if (null === $this->collAcceptances || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collAcceptances) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getAcceptances());
                }
                $query = EmpevalAcceptanceQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsers($this)
                    ->count($con);
            }
        } else {
            return count($this->collAcceptances);
        }
    }

    /**
     * Method called to associate a EmpevalAcceptance object to this object
     * through the EmpevalAcceptance foreign key attribute.
     *
     * @param    EmpevalAcceptance $l EmpevalAcceptance
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addAcceptance(EmpevalAcceptance $l)
    {
        if ($this->collAcceptances === null) {
            $this->initAcceptances();
            $this->collAcceptancesPartial = true;
        }
        if (!$this->collAcceptances->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddAcceptance($l);
        }

        return $this;
    }

    /**
     * @param	Acceptance $acceptance The acceptance object to add.
     */
    protected function doAddAcceptance($acceptance)
    {
        $this->collAcceptances[]= $acceptance;
        $acceptance->setUsers($this);
    }

    /**
     * @param	Acceptance $acceptance The acceptance object to remove.
     */
    public function removeAcceptance($acceptance)
    {
        if ($this->getAcceptances()->contains($acceptance)) {
            $this->collAcceptances->remove($this->collAcceptances->search($acceptance));
            if (null === $this->acceptancesScheduledForDeletion) {
                $this->acceptancesScheduledForDeletion = clone $this->collAcceptances;
                $this->acceptancesScheduledForDeletion->clear();
            }
            $this->acceptancesScheduledForDeletion[]= $acceptance;
            $acceptance->setUsers(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related Acceptances from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalAcceptance[] List of EmpevalAcceptance objects
     */
    public function getAcceptancesJoinBonusGoalsForms($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalAcceptanceQuery::create(null, $criteria);
        $query->joinWith('BonusGoalsForms', $join_behavior);

        return $this->getAcceptances($query, $con);
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related Acceptances from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalAcceptance[] List of EmpevalAcceptance objects
     */
    public function getAcceptancesJoinViewBgfWithSuperiorPositionId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalAcceptanceQuery::create(null, $criteria);
        $query->joinWith('ViewBgfWithSuperiorPositionId', $join_behavior);

        return $this->getAcceptances($query, $con);
    }

    /**
     * Clears out the collViewBgfWithSuperiorPositionIds collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addViewBgfWithSuperiorPositionIds()
     */
    public function clearViewBgfWithSuperiorPositionIds()
    {
        $this->collViewBgfWithSuperiorPositionIds = null; // important to set this to null since that means it is uninitialized
        $this->collViewBgfWithSuperiorPositionIdsPartial = null;
    }

    /**
     * reset is the collViewBgfWithSuperiorPositionIds collection loaded partially
     *
     * @return void
     */
    public function resetPartialViewBgfWithSuperiorPositionIds($v = true)
    {
        $this->collViewBgfWithSuperiorPositionIdsPartial = $v;
    }

    /**
     * Initializes the collViewBgfWithSuperiorPositionIds collection.
     *
     * By default this just sets the collViewBgfWithSuperiorPositionIds collection to an empty array (like clearcollViewBgfWithSuperiorPositionIds());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initViewBgfWithSuperiorPositionIds($overrideExisting = true)
    {
        if (null !== $this->collViewBgfWithSuperiorPositionIds && !$overrideExisting) {
            return;
        }
        $this->collViewBgfWithSuperiorPositionIds = new PropelObjectCollection();
        $this->collViewBgfWithSuperiorPositionIds->setModel('EmpevalViewBgfWithSuperiorPositionId');
    }

    /**
     * Gets an array of EmpevalViewBgfWithSuperiorPositionId objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalViewBgfWithSuperiorPositionId[] List of EmpevalViewBgfWithSuperiorPositionId objects
     * @throws PropelException
     */
    public function getViewBgfWithSuperiorPositionIds($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collViewBgfWithSuperiorPositionIdsPartial && !$this->isNew();
        if (null === $this->collViewBgfWithSuperiorPositionIds || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collViewBgfWithSuperiorPositionIds) {
                // return empty collection
                $this->initViewBgfWithSuperiorPositionIds();
            } else {
                $collViewBgfWithSuperiorPositionIds = EmpevalViewBgfWithSuperiorPositionIdQuery::create(null, $criteria)
                    ->filterByUsers($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collViewBgfWithSuperiorPositionIdsPartial && count($collViewBgfWithSuperiorPositionIds)) {
                      $this->initViewBgfWithSuperiorPositionIds(false);

                      foreach($collViewBgfWithSuperiorPositionIds as $obj) {
                        if (false == $this->collViewBgfWithSuperiorPositionIds->contains($obj)) {
                          $this->collViewBgfWithSuperiorPositionIds->append($obj);
                        }
                      }

                      $this->collViewBgfWithSuperiorPositionIdsPartial = true;
                    }

                    return $collViewBgfWithSuperiorPositionIds;
                }

                if($partial && $this->collViewBgfWithSuperiorPositionIds) {
                    foreach($this->collViewBgfWithSuperiorPositionIds as $obj) {
                        if($obj->isNew()) {
                            $collViewBgfWithSuperiorPositionIds[] = $obj;
                        }
                    }
                }

                $this->collViewBgfWithSuperiorPositionIds = $collViewBgfWithSuperiorPositionIds;
                $this->collViewBgfWithSuperiorPositionIdsPartial = false;
            }
        }

        return $this->collViewBgfWithSuperiorPositionIds;
    }

    /**
     * Sets a collection of ViewBgfWithSuperiorPositionId objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $viewBgfWithSuperiorPositionIds A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setViewBgfWithSuperiorPositionIds(PropelCollection $viewBgfWithSuperiorPositionIds, PropelPDO $con = null)
    {
        $this->viewBgfWithSuperiorPositionIdsScheduledForDeletion = $this->getViewBgfWithSuperiorPositionIds(new Criteria(), $con)->diff($viewBgfWithSuperiorPositionIds);

        foreach ($this->viewBgfWithSuperiorPositionIdsScheduledForDeletion as $viewBgfWithSuperiorPositionIdRemoved) {
            $viewBgfWithSuperiorPositionIdRemoved->setUsers(null);
        }

        $this->collViewBgfWithSuperiorPositionIds = null;
        foreach ($viewBgfWithSuperiorPositionIds as $viewBgfWithSuperiorPositionId) {
            $this->addViewBgfWithSuperiorPositionId($viewBgfWithSuperiorPositionId);
        }

        $this->collViewBgfWithSuperiorPositionIds = $viewBgfWithSuperiorPositionIds;
        $this->collViewBgfWithSuperiorPositionIdsPartial = false;
    }

    /**
     * Returns the number of related EmpevalViewBgfWithSuperiorPositionId objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalViewBgfWithSuperiorPositionId objects.
     * @throws PropelException
     */
    public function countViewBgfWithSuperiorPositionIds(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collViewBgfWithSuperiorPositionIdsPartial && !$this->isNew();
        if (null === $this->collViewBgfWithSuperiorPositionIds || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collViewBgfWithSuperiorPositionIds) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getViewBgfWithSuperiorPositionIds());
                }
                $query = EmpevalViewBgfWithSuperiorPositionIdQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsers($this)
                    ->count($con);
            }
        } else {
            return count($this->collViewBgfWithSuperiorPositionIds);
        }
    }

    /**
     * Method called to associate a EmpevalViewBgfWithSuperiorPositionId object to this object
     * through the EmpevalViewBgfWithSuperiorPositionId foreign key attribute.
     *
     * @param    EmpevalViewBgfWithSuperiorPositionId $l EmpevalViewBgfWithSuperiorPositionId
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addViewBgfWithSuperiorPositionId(EmpevalViewBgfWithSuperiorPositionId $l)
    {
        if ($this->collViewBgfWithSuperiorPositionIds === null) {
            $this->initViewBgfWithSuperiorPositionIds();
            $this->collViewBgfWithSuperiorPositionIdsPartial = true;
        }
        if (!$this->collViewBgfWithSuperiorPositionIds->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddViewBgfWithSuperiorPositionId($l);
        }

        return $this;
    }

    /**
     * @param	ViewBgfWithSuperiorPositionId $viewBgfWithSuperiorPositionId The viewBgfWithSuperiorPositionId object to add.
     */
    protected function doAddViewBgfWithSuperiorPositionId($viewBgfWithSuperiorPositionId)
    {
        $this->collViewBgfWithSuperiorPositionIds[]= $viewBgfWithSuperiorPositionId;
        $viewBgfWithSuperiorPositionId->setUsers($this);
    }

    /**
     * @param	ViewBgfWithSuperiorPositionId $viewBgfWithSuperiorPositionId The viewBgfWithSuperiorPositionId object to remove.
     */
    public function removeViewBgfWithSuperiorPositionId($viewBgfWithSuperiorPositionId)
    {
        if ($this->getViewBgfWithSuperiorPositionIds()->contains($viewBgfWithSuperiorPositionId)) {
            $this->collViewBgfWithSuperiorPositionIds->remove($this->collViewBgfWithSuperiorPositionIds->search($viewBgfWithSuperiorPositionId));
            if (null === $this->viewBgfWithSuperiorPositionIdsScheduledForDeletion) {
                $this->viewBgfWithSuperiorPositionIdsScheduledForDeletion = clone $this->collViewBgfWithSuperiorPositionIds;
                $this->viewBgfWithSuperiorPositionIdsScheduledForDeletion->clear();
            }
            $this->viewBgfWithSuperiorPositionIdsScheduledForDeletion[]= $viewBgfWithSuperiorPositionId;
            $viewBgfWithSuperiorPositionId->setUsers(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related ViewBgfWithSuperiorPositionIds from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalViewBgfWithSuperiorPositionId[] List of EmpevalViewBgfWithSuperiorPositionId objects
     */
    public function getViewBgfWithSuperiorPositionIdsJoinBonusPeriods($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalViewBgfWithSuperiorPositionIdQuery::create(null, $criteria);
        $query->joinWith('BonusPeriods', $join_behavior);

        return $this->getViewBgfWithSuperiorPositionIds($query, $con);
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related ViewBgfWithSuperiorPositionIds from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalViewBgfWithSuperiorPositionId[] List of EmpevalViewBgfWithSuperiorPositionId objects
     */
    public function getViewBgfWithSuperiorPositionIdsJoinUserPositionsRelatedByUserPositionId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalViewBgfWithSuperiorPositionIdQuery::create(null, $criteria);
        $query->joinWith('UserPositionsRelatedByUserPositionId', $join_behavior);

        return $this->getViewBgfWithSuperiorPositionIds($query, $con);
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related ViewBgfWithSuperiorPositionIds from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalViewBgfWithSuperiorPositionId[] List of EmpevalViewBgfWithSuperiorPositionId objects
     */
    public function getViewBgfWithSuperiorPositionIdsJoinUserPositionsRelatedBySuperiorUserPositionId($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalViewBgfWithSuperiorPositionIdQuery::create(null, $criteria);
        $query->joinWith('UserPositionsRelatedBySuperiorUserPositionId', $join_behavior);

        return $this->getViewBgfWithSuperiorPositionIds($query, $con);
    }

    /**
     * Clears out the collNotificationUserss collection
     *
     * This does not modify the database; however, it will remove any associated objects, causing
     * them to be refetched by subsequent calls to accessor method.
     *
     * @return void
     * @see        addNotificationUserss()
     */
    public function clearNotificationUserss()
    {
        $this->collNotificationUserss = null; // important to set this to null since that means it is uninitialized
        $this->collNotificationUserssPartial = null;
    }

    /**
     * reset is the collNotificationUserss collection loaded partially
     *
     * @return void
     */
    public function resetPartialNotificationUserss($v = true)
    {
        $this->collNotificationUserssPartial = $v;
    }

    /**
     * Initializes the collNotificationUserss collection.
     *
     * By default this just sets the collNotificationUserss collection to an empty array (like clearcollNotificationUserss());
     * however, you may wish to override this method in your stub class to provide setting appropriate
     * to your application -- for example, setting the initial array to the values stored in database.
     *
     * @param boolean $overrideExisting If set to true, the method call initializes
     *                                        the collection even if it is not empty
     *
     * @return void
     */
    public function initNotificationUserss($overrideExisting = true)
    {
        if (null !== $this->collNotificationUserss && !$overrideExisting) {
            return;
        }
        $this->collNotificationUserss = new PropelObjectCollection();
        $this->collNotificationUserss->setModel('EmpevalNotificationUsers');
    }

    /**
     * Gets an array of EmpevalNotificationUsers objects which contain a foreign key that references this object.
     *
     * If the $criteria is not null, it is used to always fetch the results from the database.
     * Otherwise the results are fetched from the database the first time, then cached.
     * Next time the same method is called without $criteria, the cached collection is returned.
     * If this EmpevalUsers is new, it will return
     * an empty collection or the current collection; the criteria is ignored on a new object.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @return PropelObjectCollection|EmpevalNotificationUsers[] List of EmpevalNotificationUsers objects
     * @throws PropelException
     */
    public function getNotificationUserss($criteria = null, PropelPDO $con = null)
    {
        $partial = $this->collNotificationUserssPartial && !$this->isNew();
        if (null === $this->collNotificationUserss || null !== $criteria  || $partial) {
            if ($this->isNew() && null === $this->collNotificationUserss) {
                // return empty collection
                $this->initNotificationUserss();
            } else {
                $collNotificationUserss = EmpevalNotificationUsersQuery::create(null, $criteria)
                    ->filterByUsers($this)
                    ->find($con);
                if (null !== $criteria) {
                    if (false !== $this->collNotificationUserssPartial && count($collNotificationUserss)) {
                      $this->initNotificationUserss(false);

                      foreach($collNotificationUserss as $obj) {
                        if (false == $this->collNotificationUserss->contains($obj)) {
                          $this->collNotificationUserss->append($obj);
                        }
                      }

                      $this->collNotificationUserssPartial = true;
                    }

                    return $collNotificationUserss;
                }

                if($partial && $this->collNotificationUserss) {
                    foreach($this->collNotificationUserss as $obj) {
                        if($obj->isNew()) {
                            $collNotificationUserss[] = $obj;
                        }
                    }
                }

                $this->collNotificationUserss = $collNotificationUserss;
                $this->collNotificationUserssPartial = false;
            }
        }

        return $this->collNotificationUserss;
    }

    /**
     * Sets a collection of NotificationUsers objects related by a one-to-many relationship
     * to the current object.
     * It will also schedule objects for deletion based on a diff between old objects (aka persisted)
     * and new objects from the given Propel collection.
     *
     * @param PropelCollection $notificationUserss A Propel collection.
     * @param PropelPDO $con Optional connection object
     */
    public function setNotificationUserss(PropelCollection $notificationUserss, PropelPDO $con = null)
    {
        $this->notificationUserssScheduledForDeletion = $this->getNotificationUserss(new Criteria(), $con)->diff($notificationUserss);

        foreach ($this->notificationUserssScheduledForDeletion as $notificationUsersRemoved) {
            $notificationUsersRemoved->setUsers(null);
        }

        $this->collNotificationUserss = null;
        foreach ($notificationUserss as $notificationUsers) {
            $this->addNotificationUsers($notificationUsers);
        }

        $this->collNotificationUserss = $notificationUserss;
        $this->collNotificationUserssPartial = false;
    }

    /**
     * Returns the number of related EmpevalNotificationUsers objects.
     *
     * @param Criteria $criteria
     * @param boolean $distinct
     * @param PropelPDO $con
     * @return int             Count of related EmpevalNotificationUsers objects.
     * @throws PropelException
     */
    public function countNotificationUserss(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
    {
        $partial = $this->collNotificationUserssPartial && !$this->isNew();
        if (null === $this->collNotificationUserss || null !== $criteria || $partial) {
            if ($this->isNew() && null === $this->collNotificationUserss) {
                return 0;
            } else {
                if($partial && !$criteria) {
                    return count($this->getNotificationUserss());
                }
                $query = EmpevalNotificationUsersQuery::create(null, $criteria);
                if ($distinct) {
                    $query->distinct();
                }

                return $query
                    ->filterByUsers($this)
                    ->count($con);
            }
        } else {
            return count($this->collNotificationUserss);
        }
    }

    /**
     * Method called to associate a EmpevalNotificationUsers object to this object
     * through the EmpevalNotificationUsers foreign key attribute.
     *
     * @param    EmpevalNotificationUsers $l EmpevalNotificationUsers
     * @return EmpevalUsers The current object (for fluent API support)
     */
    public function addNotificationUsers(EmpevalNotificationUsers $l)
    {
        if ($this->collNotificationUserss === null) {
            $this->initNotificationUserss();
            $this->collNotificationUserssPartial = true;
        }
        if (!$this->collNotificationUserss->contains($l)) { // only add it if the **same** object is not already associated
            $this->doAddNotificationUsers($l);
        }

        return $this;
    }

    /**
     * @param	NotificationUsers $notificationUsers The notificationUsers object to add.
     */
    protected function doAddNotificationUsers($notificationUsers)
    {
        $this->collNotificationUserss[]= $notificationUsers;
        $notificationUsers->setUsers($this);
    }

    /**
     * @param	NotificationUsers $notificationUsers The notificationUsers object to remove.
     */
    public function removeNotificationUsers($notificationUsers)
    {
        if ($this->getNotificationUserss()->contains($notificationUsers)) {
            $this->collNotificationUserss->remove($this->collNotificationUserss->search($notificationUsers));
            if (null === $this->notificationUserssScheduledForDeletion) {
                $this->notificationUserssScheduledForDeletion = clone $this->collNotificationUserss;
                $this->notificationUserssScheduledForDeletion->clear();
            }
            $this->notificationUserssScheduledForDeletion[]= $notificationUsers;
            $notificationUsers->setUsers(null);
        }
    }


    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Users is new, it will return
     * an empty collection; or if this Users has previously
     * been saved, it will retrieve related NotificationUserss from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Users.
     *
     * @param Criteria $criteria optional Criteria object to narrow the query
     * @param PropelPDO $con optional connection object
     * @param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
     * @return PropelObjectCollection|EmpevalNotificationUsers[] List of EmpevalNotificationUsers objects
     */
    public function getNotificationUserssJoinNotifications($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $query = EmpevalNotificationUsersQuery::create(null, $criteria);
        $query->joinWith('Notifications', $join_behavior);

        return $this->getNotificationUserss($query, $con);
    }

    /**
     * Clears the current object and sets all attributes to their default values
     */
    public function clear()
    {
        $this->id = null;
        $this->ext_id = null;
        $this->fname = null;
        $this->lname = null;
        $this->email = null;
        $this->optional_email = null;
        $this->password = null;
        $this->company = null;
        $this->phone = null;
        $this->mobile = null;
        $this->photo = null;
        $this->ad_login_1 = null;
        $this->ad_login_2 = null;
        $this->ad_login_3 = null;
        $this->deleted = null;
        $this->active = null;
        $this->last_modified = null;
        $this->created = null;
        $this->alreadyInSave = false;
        $this->alreadyInValidation = false;
        $this->clearAllReferences();
        $this->applyDefaultValues();
        $this->resetModified();
        $this->setNew(true);
        $this->setDeleted(false);
    }

    /**
     * Resets all references to other model objects or collections of model objects.
     *
     * This method is a user-space workaround for PHP's inability to garbage collect
     * objects with circular references (even in PHP 5.3). This is currently necessary
     * when using Propel in certain daemon or large-volumne/high-memory operations.
     *
     * @param boolean $deep Whether to also clear the references on all referrer objects.
     */
    public function clearAllReferences($deep = false)
    {
        if ($deep) {
            if ($this->collBonusGoalsFormss) {
                foreach ($this->collBonusGoalsFormss as $o) {
                    $o->clearAllReferences($deep);
                }
            }
            if ($this->collSummarys) {
                foreach ($this->collSummarys as $o) {
                    $o->clearAllReferences($deep);
                }
            }
            if ($this->collEmployeeEvaluationss) {
                foreach ($this->collEmployeeEvaluationss as $o) {
                    $o->clearAllReferences($deep);
                }
            }
            if ($this->collUserRolessRelatedByFormUserId) {
                foreach ($this->collUserRolessRelatedByFormUserId as $o) {
                    $o->clearAllReferences($deep);
                }
            }
            if ($this->collUserRolessRelatedByToUserId) {
                foreach ($this->collUserRolessRelatedByToUserId as $o) {
                    $o->clearAllReferences($deep);
                }
            }
            if ($this->collCommitteess) {
                foreach ($this->collCommitteess as $o) {
                    $o->clearAllReferences($deep);
                }
            }
            if ($this->collUserPositionss) {
                foreach ($this->collUserPositionss as $o) {
                    $o->clearAllReferences($deep);
                }
            }
            if ($this->collAcceptances) {
                foreach ($this->collAcceptances as $o) {
                    $o->clearAllReferences($deep);
                }
            }
            if ($this->collViewBgfWithSuperiorPositionIds) {
                foreach ($this->collViewBgfWithSuperiorPositionIds as $o) {
                    $o->clearAllReferences($deep);
                }
            }
            if ($this->collNotificationUserss) {
                foreach ($this->collNotificationUserss as $o) {
                    $o->clearAllReferences($deep);
                }
            }
        } // if ($deep)

        if ($this->collBonusGoalsFormss instanceof PropelCollection) {
            $this->collBonusGoalsFormss->clearIterator();
        }
        $this->collBonusGoalsFormss = null;
        if ($this->collSummarys instanceof PropelCollection) {
            $this->collSummarys->clearIterator();
        }
        $this->collSummarys = null;
        if ($this->collEmployeeEvaluationss instanceof PropelCollection) {
            $this->collEmployeeEvaluationss->clearIterator();
        }
        $this->collEmployeeEvaluationss = null;
        if ($this->collUserRolessRelatedByFormUserId instanceof PropelCollection) {
            $this->collUserRolessRelatedByFormUserId->clearIterator();
        }
        $this->collUserRolessRelatedByFormUserId = null;
        if ($this->collUserRolessRelatedByToUserId instanceof PropelCollection) {
            $this->collUserRolessRelatedByToUserId->clearIterator();
        }
        $this->collUserRolessRelatedByToUserId = null;
        if ($this->collCommitteess instanceof PropelCollection) {
            $this->collCommitteess->clearIterator();
        }
        $this->collCommitteess = null;
        if ($this->collUserPositionss instanceof PropelCollection) {
            $this->collUserPositionss->clearIterator();
        }
        $this->collUserPositionss = null;
        if ($this->collAcceptances instanceof PropelCollection) {
            $this->collAcceptances->clearIterator();
        }
        $this->collAcceptances = null;
        if ($this->collViewBgfWithSuperiorPositionIds instanceof PropelCollection) {
            $this->collViewBgfWithSuperiorPositionIds->clearIterator();
        }
        $this->collViewBgfWithSuperiorPositionIds = null;
        if ($this->collNotificationUserss instanceof PropelCollection) {
            $this->collNotificationUserss->clearIterator();
        }
        $this->collNotificationUserss = null;
    }

    /**
     * return the string representation of this object
     *
     * @return string
     */
    public function __toString()
    {
        return (string) $this->exportTo(EmpevalUsersPeer::DEFAULT_STRING_FORMAT);
    }

    /**
     * return true is the object is in saving state
     *
     * @return boolean
     */
    public function isAlreadyInSave()
    {
        return $this->alreadyInSave;
    }

}
